|
Boost Users : |
Subject: Re: [Boost-users] [shared_ptr] Using a custom delete function that is a class member function
From: Peter Dimov (pdimov_at_[hidden])
Date: 2009-10-10 12:22:37
Ryan McConnehey wrote:
> Steven Watanabe wrote:
>> Check you parentheses. The two uses of bind/mem_fun are not the
>> same.
> Sorry, the line should read as follows.
>
> *itor = bus(new unsigned short(startValue++),
> boost::bind(boost::mem_fun(&CTNGenerator::makeCTNAvailable), this));
You need boost::bind( &CTNGenerator::makeCTNAvailable, this, _1 ). bind will
automatically insert the mem_fn for you. Being a member function,
makeCTNAvailable takes two arguments: the hidden 'this' and 'ctn'. _1 routes
the pointer argument of the deleter into its proper position as 'ctn'.
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