|
Boost : |
From: Fernando Cacciola (fernando.cacciola_at_[hidden])
Date: 2008-04-11 15:01:58
Hi Andrey,
> Your behavior can be implemented in a non-intrusive way something like
> that:
>
> template< typename T >
> void force_koenig_swap(optional< T >& left, optional< T >& right)
> {
> bool left_empty = !left;
> if (left_empty) left = in_place();
> bool right_empty = !right;
> if (right_empty) right = in_place();
>
> using std::swap;
> swap(left.get(), right.get());
>
> if (left_empty) right = none;
> if (right_empty) left = none;
> }
>
But isn't that, syntax aside, *exactly* the same Thorsten proposed?? I can't
tell the difference...
Best
-- Fernando Cacciola SciSoft http://fcacciola.50webs.com http://groups.google.com/group/cppba
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk