[Boost-bugs] [Boost C++ Libraries] #8625: Add function to indicate if `swap` is no-throw

Subject: [Boost-bugs] [Boost C++ Libraries] #8625: Add function to indicate if `swap` is no-throw
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-05-28 14:24:02


#8625: Add function to indicate if `swap` is no-throw
------------------------------+---------------------------------------------
 Reporter: dlwalker | Owner: joseph.gauterin
     Type: Feature Requests | Status: new
Milestone: Boost 1.55.0 | Component: swap
  Version: Boost 1.55.0 | Severity: Optimization
 Keywords: swap noexcept |
------------------------------+---------------------------------------------
 While writing a library for Boost, I found the need for this function:

 {{{
     #include <utility>

     //! Detect if a type's swap (found via ADL for
     //! non-built-ins) throws.
     template < typename T, typename U = T >
     inline constexpr
     bool is_swap_nothrow() noexcept
     {
         using std::swap;

         return noexcept( swap(std::declval<T &>(),
          std::declval<U &>()) );
     }
 }}}

 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.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8625>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC