Boost logo

Boost :

From: Noel Yap (Noel.Yap_at_[hidden])
Date: 2003-04-24 10:33:53


Terje Slettebø wrote:
> The part about RVO was really concerned with the out() scenario, not
> in_out(). I'm not sure if passing a smart pointer buys you very much. In
> this case, the smart pointer is const but the pointee is not, so the "const"
> in the signature is really just masking what is going on.

You're right. I see your point.

At first I thought that if there were an easy way to convert smart_ptr<
T > to smart_ptr< T const > there'd be no problem. But then I realized
this would bring about the expensive copy again.

IMHO, the solution to this dilemna is to use the de facto standard way
of using references like you said earlier:

  void f( T& value_may_change_, T const& value_may_not_change_ );

Noel

-- 
NOTICE: If received in error, please destroy and notify sender.  Sender
does not waive confidentiality or privilege, and use is prohibited.

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