pothosware / PothosCore

The Pothos data-flow framework
https://github.com/pothosware/PothosCore/wiki
Boost Software License 1.0
302 stars 48 forks source link

Pothos::Callable: add std::function constructor #180

Closed ncorgan closed 4 years ago

ncorgan commented 4 years ago

Pothos::Callable takes in various varieties of function pointers and stores everything internally as a std::function. But the class doesn't have a constructor that takes in a std::function.

The std::function class has a function target<T>() that can be used to return the equivalent function pointer, but if the std::function wraps, for example, the output of std::bind instead of a straight function, target<T>() returns null, and Pothos::Callable will throw bad_call_exception when called.