Chris@16: ////////////////////////////////////////////////////////////////////////////// Chris@16: // Chris@16: // (C) Copyright Ion Gaztanaga 2009-2012. Chris@16: // Distributed under the Boost Software License, Version 1.0. Chris@16: // (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: // Chris@16: // See http://www.boost.org/libs/move for documentation. Chris@16: // Chris@16: ////////////////////////////////////////////////////////////////////////////// Chris@16: Chris@16: //! \file Chris@16: Chris@101: #ifndef BOOST_MOVE_TRAITS_HPP Chris@101: #define BOOST_MOVE_TRAITS_HPP Chris@101: Chris@101: #ifndef BOOST_CONFIG_HPP Chris@101: # include Chris@101: #endif Chris@101: # Chris@101: #if defined(BOOST_HAS_PRAGMA_ONCE) Chris@101: # pragma once Chris@101: #endif Chris@16: Chris@16: #include Chris@16: Chris@16: #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES Chris@16: #include Chris@16: #endif Chris@101: #include Chris@101: #include Chris@16: Chris@16: namespace boost { Chris@16: Chris@16: //! If this trait yields to true Chris@16: //! (has_trivial_destructor_after_move <T>::value == true) Chris@16: //! means that if T is used as argument of a move construction/assignment, Chris@16: //! there is no need to call T's destructor. Chris@16: //! This optimization tipically is used to improve containers' performance. Chris@16: //! Chris@16: //! By default this trait is true if the type has trivial destructor, Chris@16: //! every class should specialize this trait if it wants to improve performance Chris@16: //! when inserted in containers. Chris@16: template Chris@16: struct has_trivial_destructor_after_move Chris@101: : ::boost::move_detail::is_trivially_destructible Chris@16: {}; Chris@16: Chris@16: //! By default this traits returns Chris@16: //!
boost::is_nothrow_move_constructible::value && boost::is_nothrow_move_assignable::value 
. Chris@16: //! Classes with non-throwing move constructor Chris@16: //! and assignment can specialize this trait to obtain some performance improvements. Chris@16: template Chris@16: struct has_nothrow_move Chris@101: { Chris@101: static const bool value = boost::move_detail::is_nothrow_move_constructible::value && Chris@101: boost::move_detail::is_nothrow_move_assignable::value; Chris@101: }; Chris@16: Chris@16: namespace move_detail { Chris@16: Chris@101: template Chris@101: struct is_nothrow_move_constructible_or_uncopyable Chris@101: { Chris@101: //The standard requires is_nothrow_move_constructible for move_if_noexcept Chris@101: //but a user (usually in C++03) might specialize has_nothrow_move which includes it Chris@101: static const bool value = is_nothrow_move_constructible::value || Chris@101: has_nothrow_move::value || Chris@101: !is_copy_constructible::value; Chris@101: }; Chris@16: Chris@16: } //move_detail { Chris@16: } //namespace boost { Chris@16: Chris@16: #include Chris@16: Chris@101: #endif //#ifndef BOOST_MOVE_TRAITS_HPP