Boost logo

Boost Users :

Subject: Re: [Boost-users] Nesting bind with shared_ptr<T>::operator* and ref
From: Chris Stankevitz (chrisstankevitz_at_[hidden])
Date: 2013-06-04 13:36:03


On Mon, Jun 3, 2013 at 5:33 PM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
> using boost::phoenix::bind;
> using boost::phoenix::placeholders::_1;
> bind(x, *bind(GetC, _1))

Steven,

Thank you, I did not know about phoenix's operator capability.

Do you agree with this statement:

GetC increments the shared_ptr's reference count when it returns a
shared_ptr to operator*. After operator* dereferences, it decrements
the shared_ptr reference count. Then the function "x" is executed.
Hence nobody is holding a reference count on behalf of function "x".

Thank you again,

Chris


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