
Hi Arno,
Regular assignment, without killing the source, should work as well, though.
Right... so your very first proposal can't really be replaced by Niels's poposals optional_swap() and move_to(). So the next big question would be: With C++0x, optional_swap() and otional_move_to(), both worth by their own right IMO, will be implementable as free functions, which I prefer to member functions. But that can't be implemented today without a move emulation library, like Ion GaztaƱaga's Boost.Move. Yet even if I wanted to use that, I can't before it is formally added into boost. So, the choice *right now* is to either add these two functions as members or not add them at all. But if I add them as members today, there would be a slight inconsistency with optional_assing being a free function instead. Thus, until move semantics are practically usable (whether via Boost.Move or C++0x) I would either add the three functions as member functions, or just your optional_assign() as a free function, but not two members and one free standing. What do you think? -- Fernando Cacciola SciSoft Consulting, Founder http://www.scisoft-consulting.com