boostorg / boostorg/compute

Anyway to define and use other utilities function within the lambda functions?

Open
#736 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.7k
Forks
340
PR merge metrics
No merged PRs in 30d

Description

Just wondering how do I pass/declare a helper function to the kernel function so they can be used within BOOST_COMPUTE_FUNCTION or BOOST_COMPUTE_CLOSURE.

I saw the BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION macro but not quite sure how to use it or even if it is the correct way to declare a new function that is accessible from within a lambda.

Something in the range of this example, basically trying to inline this foo() into bar().
```
inline float foo()
{
return -1.0f;
}

BOOST_COMPUTE_FUNCTION(float, bar, (float in),
{
return in + foo();
})
```

Any advise is appreciated, thanks.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.