From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2008-04-10 16:53:40
-----BEGIN PGP SIGNED MESSAGE-----
On Thursday 10 April 2008 16:02 pm, Thorsten Ottosen wrote:
> > Your approach requires the T to be default constructible which is not
> > always the case.
> Why is this better than the far more expensive copy-construction?
The documentation indicates optional<T> requires T to be copy constructible.
It explicitly does not require T to be default constructible.
> > Besides, to my mind, the current implementation is more
> > obvious for the user.
> No user expects swap to throw or invalidate iterators or references like
> the current implementation does.
Personally, I consider any preservation of iterators/references/pointers to
the internals of a swapped object to be purely a side-effect of a swap
specialization, whose raise d'etre is as a speed optimization.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
-----END PGP SIGNATURE-----
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk