Boost logo

Boost Users :

Subject: Re: [Boost-users] [function] How to use function with templated member functions
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2011-12-06 00:27:12


> Hi there, I would like to boost::function with a templated member
> function. Please consider the following code:
>
> [snip]
>
> This doesn't compile with Visual Studio 2010 since the compiler cannot:
>
> "cannot convert from 'overloaded-function' to 'boost::function<Signature>'"
>
> Is there is way to make this happen?

Your code compiles fine for me on GCC 4.6. I'm not sure why it doesn't work
with Visual Studio.

Perhaps you can try wrapping the function pointers with boost::mem_fn(),
like this:

_read_function = boost::mem_fn(&my_reader::read_full<int>);

Maybe that helps.

Regards,
Nate

                                               


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net