|
Boost : |
Subject: Re: [boost] [optional] little addition
From: David Abrahams (dave_at_[hidden])
Date: 2009-02-27 14:10:33
On Feb 27, 2009, at 4:08 AM, Arno Schödl wrote:
> I just started using boost::optional, and this proved to be
> generically useful, but I believe is currently not in boost::optional:
> boost::optional< TMyValue > TryToGetT();
> T t;
>
> if( !optional_assign( t, TryToGetT () ) {
> ... other way to get t ...
> }
>
> instead of the more verbose:
>
> boost::optional< TMyValue > TryToGetT();
> T t;
So you dislike
if ( !(t = TryToGetT()) ) {
...other way to get t ...
}
For efficiency reasons?
-- David Abrahams BoostPro Computing http://boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk