Boost logo

Boost-Commit :

From: nielsdekker_at_[hidden]
Date: 2008-08-16 04:56:20


Author: niels_dekker
Date: 2008-08-16 04:56:19 EDT (Sat, 16 Aug 2008)
New Revision: 48171
URL: http://svn.boost.org/trac/boost/changeset/48171

Log:
Added explanatory comments, requested by Isaac Dupree, "Re: [boost] [swap] Renaming boost_swap_impl::swap_impl and/or its namespace?", http://lists.boost.org/Archives/boost/2008/08/141007.php
Text files modified:
   trunk/boost/utility/swap.hpp | 12 ++++++++++++
   1 files changed, 12 insertions(+), 0 deletions(-)

Modified: trunk/boost/utility/swap.hpp
==============================================================================
--- trunk/boost/utility/swap.hpp (original)
+++ trunk/boost/utility/swap.hpp 2008-08-16 04:56:19 EDT (Sat, 16 Aug 2008)
@@ -9,6 +9,18 @@
 #ifndef BOOST_UTILITY_SWAP_HPP
 #define BOOST_UTILITY_SWAP_HPP
 
+// Note: the implementation of this utility contains various workarounds:
+// - swap_impl is put outside the boost namespace, to avoid infinite
+// recursion (causing stack overflow) when swapping objects of a primitive
+// type.
+// - swap_impl has a using-directive, rather than a using-declaration,
+// because some compilers (including MSVC 7.1, Borland 5.9.3, and
+// Intel 8.1) don't do argument-dependent lookup when it has a
+// using-declaration instead.
+// - boost::swap has two template arguments, instead of one, to
+// avoid ambiguity when swapping objects of a Boost type that does
+// not have its own boost::swap overload.
+
 #include <algorithm> //for std::swap
 #include <cstddef> //for std::size_t
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk