phoenix bind template parameter
Hello, I try to use phoenix bind to bind std::pow for double values, but I get errors, because the template parameters not set: phoenix::bind(&std::pow, _val, _1) I would like to compile it with C++11. How can I setup the template parameter on the phoenix bind? At the moment I have defined a function double mypow(double a, double b) { return std::pow(a,b); } but can I do this directly with std::pow in the bind call? Thanks a lot Phil
Hi Phil, Since std::pow has a few different overloads (for things like long double std::complex, etc.) you're probably running into the problem described here: < http://www.boost.org/doc/libs/1_57_0/libs/bind/bind.html#err_overloaded> The solution it suggests will work in your case. Happily, phoenix makes it easy to call cmath functions by wrapping them in this file: < https://github.com/boostorg/phoenix/blob/master/include/boost/phoenix/stl/cmath.hpp> So you should be able to call pow without messing with bind. HTH, Nate On Wed, Dec 3, 2014 at 1:34 PM, Philipp Kraus <philipp.kraus@flashpixx.de> wrote:
Hello,
I try to use phoenix bind to bind std::pow for double values, but I get errors, because the template parameters not set:
phoenix::bind(&std::pow, _val, _1)
I would like to compile it with C++11. How can I setup the template parameter on the phoenix bind? At the moment I have defined a function double mypow(double a, double b) { return std::pow(a,b); } but can I do this directly with std::pow in the bind call?
Thanks a lot
Phil
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Nate Crookston
-
Philipp Kraus