Boost logo

Boost :

Subject: Re: [boost] [SPAM (Header)] - Re: [optional] little addition... optional_assign_to, optional_move_to, optional_swap? - Number of numbers in MIME From exceeds maximum threshold
From: Fernando Cacciola (fernando.cacciola_at_[hidden])
Date: 2009-03-06 18:21:42


Hi Arno,

> Just for my understanding, why are optional_swap and optional_move_to not expessible as free functions?
>
> template< class T, class U >
> bool optional_move( T& t, boost::optional<U>& u ) {

> template< class T >
> bool optional_move( T& t, boost::optional<T>& u ) {

Just that 'u' there can't be an rvalue, which was one of the motivating
requirements.

And of course, if you overload for "const&", then you can't swap.

This is incidentally one of the reasons 'const' and 'rvalue-ness' isn't
exactly the same: you can call a mutating (non-const) method on rvalues.

Best

--
Fernando Cacciola
SciSoft Consulting, Founder
http://www.scisoft-consulting.com

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