Re: object-model: Return by value, reference or pointer? (or something else?)
From: Steinar Bang <sb_at_dod.no>
Date: Thu, 14 Oct 2010 10:37:34 +0200
>>>>> "Hyrum K. Wright" <hyrum_wright_at_mail.utexas.edu>:
> I don't want the caller to have to depend upon the lifetime of the
> Additionally, it still wouldn't work, since references have to point
Well... this might actually be a use for auto_ptr<string>.
If you return auto_ptr<string> you force the caller to assign it to an
If you fail to assign, the returned auto_ptr should go out of scope, and
That is... if auto_ptr<string> can hold NULL values. I don't know if it
> (This entire conversation is reminding my why I *hate* C++. To bad
(I saw a review once for Scott Meyers' "Effective C++", where the
|
This is an archived mail posted to the Subversion Dev mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.