|
|
|||
File indexing completed on 2026-09-19 09:02:37
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 "># 0022 #if defined(BOOST_HAS_PRAGMA_ONCE) 0023 # pragma once 0024 #endif 0025 0026 #include <boost/move/detail/config_begin.hpp> 0027 0028 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES 0029 #include <boost/move/core.hpp> 0030 #endif 0031 #include <boost/move/detail/meta_utils.hpp> 0032 #include <boost/move/detail/type_traits.hpp> 0033 0034 namespace boost { 0035 0036 //! If this trait yields to true 0037 //! (<i>has_trivial_destructor_after_move <T>::value == true</i>) 0038 //! means that if T is used as argument of a move construction/assignment, 0039 //! there is no need to call T's destructor. 0040 //! This optimization tipically is used to improve containers' performance. 0041 //! 0042 //! By default this trait is true if the type has trivial destructor, 0043 //! every class should specialize this trait if it wants to improve performance 0044 //! when inserted in containers. 0045 template <class T> 0046 struct has_trivial_destructor_after_move 0047 : ::boost::move_detail::is_trivially_destructible<T> 0048 {}; 0049 0050 //! By default this traits returns 0051 //! <pre>boost::is_nothrow_move_constructible<T>::value && boost::is_nothrow_move_assignable<T>::value </pre>. 0052 //! Classes with non-throwing move constructor 0053 //! and assignment can specialize this trait to obtain some performance improvements. 0054 template <class T> 0055 struct has_nothrow_move 0056 { 0057 static const bool value = boost::move_detail::is_nothrow_move_constructible<T>::value && 0058 boost::move_detail::is_nothrow_move_assignable<T>::value; 0059 }; 0060 0061 namespace move_detail { 0062 0063 template <class T> 0064 struct is_nothrow_move_constructible_or_uncopyable 0065 { 0066 //The standard requires is_nothrow_move_constructible for move_if_noexcept 0067 //but a user (usually in C++03) might specialize has_nothrow_move which includes it 0068 static const bool value = is_nothrow_move_constructible<T>::value || 0069 has_nothrow_move<T>::value || 0070 !is_copy_constructible<T>::value; 0071 }; 0072 0073 } //move_detail { 0074 } //namespace boost { 0075 0076 #include <boost/move/detail/config_end.hpp> 0077 0078 #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 |
|