AMDG On 06/04/2013 10:36 AM, Chris Stankevitz wrote:
On Mon, Jun 3, 2013 at 5:33 PM, Steven Watanabe
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".
I think that's correct. Boost.Phoenix doesn't try to mimic built-in temporary lifetime rules. I suppose you could get around it like this: let(_a = bind(GetC, _1)) [ bind(x, _a) ] In Christ, Steven Watanabe