Ticket #2056: array_support_for_sandbox_swap_html.patch
File array_support_for_sandbox_swap_html.patch, 2.4 KB (added by , 14 years ago) |
---|
-
swap.html
26 26 <p> 27 27 The alternative to using argument dependent lookup in this situation is to provide a template specialization of std::swap for every type that requires a specialized swap. Although this is legal C++, no boost libraries use this method, whereas many boost libraries provide specialized swap functions in their own namespaces. 28 28 </p> 29 <p> 30 <tt>boost::swap</tt> also supports swapping built-in arrays. Note that <tt>std::swap</tt> doesn't yet do so, but a request to add an overload of <tt>std::swap</tt> for built-in arrays has been well received by the Library Working Group of the C++ Standards Committee: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#809">LWG issue 809. std::swap should be overloaded for array types</a> 31 <tt>boost::swap</tt> is no-throw for arrays whose element type has a no-throw swap. However, if the swap function of the element type provides the strong guarantee, then <tt>boost::swap</tt> only provides the basic guarantee, for arrays of size > 1. 32 </p> 29 33 30 34 <!-- Requirements --> 31 35 <h2>Requirements</h2> … … 42 46 <ul> 43 47 <li>A template specialization of std::swap exists for T</li> 44 48 </ul> 49 <p>Or:</p> 50 <ul> 51 <li>T is a built-in array of swappable elements</li> 52 </ul> 45 53 46 54 47 55 <!-- Portability --> … … 56 64 <li> 57 65 <em>Steven Wanatabe</em> - for the idea to use a barrier namespaces, enabling the function to have the name '<tt>swap</tt>' without introducing ambiguity or infinite recursion. 58 66 </li> 67 <li> 68 <em>Niels Dekker</em> - for adding support for built-in arrays 69 </li> 59 70 <li> 60 71 <em><a href="mailto:Joseph.Gauterin@googlemail.com">Joseph Gauterin</a></em> - for the initial idea, final implementation, tests, and documentation. 61 72 </li> … … 63 74 64 75 <!-- Copyright info --> 65 76 <hr/> 66 <p>Revised: 3rd October 2007</p>77 <p>Revised: 29 June 2008</p> 67 78 <p> 68 79 Copyright 2007 Joseph Gauterin. Use, modification, and distribution are subject to the Boost Software License, Version 1.0. 69 80 (See accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or a copy at <<a href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>>.)