Ticket #2056: array_support_for_sandbox_swap_html.patch

File array_support_for_sandbox_swap_html.patch, 2.4 KB (added by niels_dekker, 14 years ago)

Documentation update regarding array support, to be applied to libs/utility/swap.html Version 2, including a note by Joseph Gauterin

  • swap.html

     
    2626    <p>
    2727      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.
    2828    </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>
    2933   
    3034    <!-- Requirements -->
    3135    <h2>Requirements</h2>
     
    4246    <ul>
    4347      <li>A template specialization of std::swap exists for T</li>
    4448    </ul>
     49    <p>Or:</p>
     50    <ul>
     51      <li>T is a built-in array of swappable elements</li>
     52    </ul>
    4553
    4654   
    4755    <!-- Portability -->
     
    5664      <li>
    5765        <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.
    5866      </li>
     67      <li>
     68        <em>Niels Dekker</em> - for adding support for built-in arrays
     69      </li>
    5970      <li>       
    6071        <em><a href="mailto:Joseph.Gauterin@googlemail.com">Joseph Gauterin</a></em> - for the initial idea, final implementation, tests, and documentation.
    6172      </li>
     
    6374
    6475    <!-- Copyright info -->   
    6576    <hr/>
    66     <p>Revised: 3rd October 2007</p>
     77    <p>Revised: 29 June 2008</p>
    6778    <p>
    6879      Copyright 2007 Joseph Gauterin. Use, modification, and distribution are subject to the Boost Software License, Version 1.0.
    6980      (See accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or a copy at &lt;<a href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>&gt;.)