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