id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 2243,value_initialized should have its own swap functions,niels_dekker,niels_dekker,"For a given type {{{T}}}, the current (1.36.0) version of {{{boost::value_initialized}}} is ''only'' Swappable if it is both !CopyConstructible and !CopyAssignable. IMO, {{{value_initialized}}} should be Swappable whenever {{{T}}} is Swappable. Moreover, when swapping {{{value_initialized}}} objects, the custom swap function of {{{T}}} should be used, whenever available. I'd like to propose resolving this issue by adding a swap member function to {{{value_initialized}}}, and a non-member swap that calls the member. (As recommended by Scott Meyers, Effective C++ Third Edition, Item 25: ''Consider support for a non-throwing swap.'') I would like to have {{{value_initialized::swap}}} calling {{{boost::swap}}} to swap its data, using the [http://svn.boost.org/svn/boost/trunk/boost/utility/swap.hpp boost::swap utility] by Joseph Gauterin ''et al'', that was recently added to the trunk. The boost::swap utility internally uses ''argument-dependent lookup'' (ADL) to find the custom swap function of {{{T}}}, if available. Thereby it works around various compiler version specific bugs regarding ADL, as tested at [http://www.boost.org/development/tests/trunk/developer/utility-swap_.html utility-swap_.html]. Moreover, it supports swapping arrays (as requested by ticket #2056), so {{{value_initialized::swap}}} would also support having {{{T}}} as a built-in array type. Please take a look at the attached patch.",Feature Requests,closed,Boost 1.37.0,utility,Boost 1.36.0,Problem,fixed,,