Boost C++ Libraries: Ticket #8625: Add function to indicate if `swap` is no-throw https://svn.boost.org/trac10/ticket/8625 <p> While writing a library for Boost, I found the need for this function: </p> <pre class="wiki"> #include &lt;utility&gt; //! Detect if a type's swap (found via ADL for //! non-built-ins) throws. template &lt; typename T, typename U = T &gt; inline constexpr bool is_swap_nothrow() noexcept { using std::swap; return noexcept( swap(std::declval&lt;T &amp;&gt;(), std::declval&lt;U &amp;&gt;()) ); } </pre><p> while writing my container's swap. You would probably use the macros for "inline," "constexpr," operator "noexcept," and the "noexcept" flag, but the function is pretty much useless unless all of those features are fully defined. The function has to be shielded from pre-C++11 compiles, of course. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8625 Trac 1.4.3