function<double(double)> - cmath

classic Classic list List threaded Threaded
4 messages Options
er
Reply | Threaded
Open this post in threaded view
|

function<double(double)> - cmath

er
Simply bringing this to the attention of the function maintainer, in
case it hasn't been mentioned before, and it has any relevance (I can
live with it).

  #include <cmath>
  #include <boost/function.hpp>
  typedef function<double(double)> f_;

// error C2440 with MSVC 2010. No such problems with GCC 4.2
  f_ f = log10;

  typedef double(*fp)(double);
  f_ f = fp( log10 ); // clumsy, but solves it

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: function<double(double)> - cmath

Kulti
On Sat, Mar 19, 2011 at 2:18 AM, er <[hidden email]> wrote:

> Simply bringing this to the attention of the function maintainer, in case it
> hasn't been mentioned before, and it has any relevance (I can live with it).
>
>  #include <cmath>
>  #include <boost/function.hpp>
>  typedef function<double(double)> f_;
>
> // error C2440 with MSVC 2010. No such problems with GCC 4.2
>  f_ f = log10;
>
>  typedef double(*fp)(double);
>  f_ f = fp( log10 ); // clumsy, but solves it
>
> _______________________________________________
> Boost-users mailing list
> [hidden email]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

Probably you need to use boost::bind?
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: function<double(double)> - cmath

Joel Falcou-3
In reply to this post by er
On 19/03/11 03:18, er wrote:
> Simply bringing this to the attention of the function maintainer, in
> case it hasn't been mentioned before, and it has any relevance (I can
> live with it).
Try:

f_ f = &log10;

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
er
Reply | Threaded
Open this post in threaded view
|

Re: function<double(double)> - cmath

er
On 3/19/11 4:48 AM, Joel Falcou wrote:
> Try:
>
> f_ f = &log10;

Error 2440 with the ampersand as well.

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users