|
||||
File indexing completed on 2025-01-18 09:40:54
0001 ////////////////////////////////////////////////////////////////////////////// 0002 // 0003 // (C) Copyright Ion Gaztanaga 2009-2012. 0004 // Distributed under the Boost Software License, Version 1.0. 0005 // (See accompanying file LICENSE_1_0.txt or copy at 0006 // http://www.boost.org/LICENSE_1_0.txt) 0007 // 0008 // See http://www.boost.org/libs/move for documentation. 0009 // 0010 ////////////////////////////////////////////////////////////////////////////// 0011 0012 //! \file 0013 0014 #ifndef BOOST_MOVE_TRAITS_HPP 0015 #define BOOST_MOVE_TRAITS_HPP 0016 0017 #ifndef BOOST_CONFIG_HPP 0018 # include <boost/config.hpp> 0019 #endif 0020 # 0021 #if defined(BOOST_HAS_PRAGMA_ONCE) 0022 # pragma once 0023 #endif 0024 0025 #include <boost/move/detail/config_begin.hpp> 0026 0027 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES 0028 #include <boost/move/core.hpp> 0029 #endif 0030 #include <boost/move/detail/meta_utils.hpp> 0031 #include <boost/move/detail/type_traits.hpp> 0032 0033 namespace boost { 0034 0035 //! If this trait yields to true 0036 //! (<i>has_trivial_destructor_after_move <T>::value == true</i>) 0037 //! means that if T is used as argument of a move construction/assignment, 0038 //! there is no need to call T's destructor. 0039 //! This optimization tipically is used to improve containers' performance. 0040 //! 0041 //! By default this trait is true if the type has trivial destructor, 0042 //! every class should specialize this trait if it wants to improve performance 0043 //! when inserted in containers. 0044 template <class T> 0045 struct has_trivial_destructor_after_move 0046 : ::boost::move_detail::is_trivially_destructible<T> 0047 {}; 0048 0049 //! By default this traits returns 0050 //! <pre>boost::is_nothrow_move_constructible<T>::value && boost::is_nothrow_move_assignable<T>::value </pre>. 0051 //! Classes with non-throwing move constructor 0052 //! and assignment can specialize this trait to obtain some performance improvements. 0053 template <class T> 0054 struct has_nothrow_move 0055 { 0056 static const bool value = boost::move_detail::is_nothrow_move_constructible<T>::value && 0057 boost::move_detail::is_nothrow_move_assignable<T>::value; 0058 }; 0059 0060 namespace move_detail { 0061 0062 template <class T> 0063 struct is_nothrow_move_constructible_or_uncopyable 0064 { 0065 //The standard requires is_nothrow_move_constructible for move_if_noexcept 0066 //but a user (usually in C++03) might specialize has_nothrow_move which includes it 0067 static const bool value = is_nothrow_move_constructible<T>::value || 0068 has_nothrow_move<T>::value || 0069 !is_copy_constructible<T>::value; 0070 }; 0071 0072 } //move_detail { 0073 } //namespace boost { 0074 0075 #include <boost/move/detail/config_end.hpp> 0076 0077 #endif //#ifndef BOOST_MOVE_TRAITS_HPP
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |