Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-04-09 09:43:17


From: "Nestal Wan Wai Ho" <me_at_[hidden]>
> Hi all,
>
> When I tried to use mem_fn() with adaptors like compose1 or
> boost::compose_f_gx, my complier said it is not happy with mem_fn's
> argument_type. I looked at mem_fn's source code and find that its
> argument_type is a T*, but in my case it should be a T. i.e. in my case
> mem_fn acts like mem_fun_ref instead of mem_fun.
>
> It is good that mem_fn does not require me to differentiate between T or
> T*, but is there a way to let me choose the argument_type I want?
> mem_fn's argument_type is "hard coded" to T* in cmf0 now. I end up using
> mem_fun_ref instead.

The short answer is: either use boost::bind instead of compose, or use
std::mem_fun_ref.

http://www.boost.org/libs/bind/mem_fn.html#Q1
http://www.boost.org/libs/bind/bind.html#nested_binds


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk