
6 Mar
2009
6 Mar
'09
11:21 p.m.
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