File indexing completed on 2025-01-18 09:43:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef BOOST_OPTIONAL_DETAIL_EXPERIMENTAL_TRAITS_04NOV2017_HPP
0013 #define BOOST_OPTIONAL_DETAIL_EXPERIMENTAL_TRAITS_04NOV2017_HPP
0014
0015 #include <boost/config.hpp>
0016 #include <boost/detail/workaround.hpp>
0017 #include <boost/predef.h>
0018 #include <boost/type_traits.hpp>
0019
0020
0021
0022 #ifdef BOOST_OPTIONAL_CONFIG_NO_POD_SPEC
0023 # define BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
0024 #elif defined BOOST_OPTIONAL_CONFIG_NO_SPEC_FOR_TRIVIAL_TYPES
0025 # define BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
0026 #elif !defined BOOST_HAS_TRIVIAL_CONSTRUCTOR
0027 # define BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
0028 #elif !defined BOOST_HAS_TRIVIAL_MOVE_ASSIGN
0029 # define BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
0030 #elif !defined BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR
0031 # define BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
0032 #elif !defined BOOST_HAS_TRIVIAL_COPY
0033 # define BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
0034 #elif !defined BOOST_HAS_TRIVIAL_ASSIGN
0035 # define BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
0036 #elif !defined BOOST_HAS_TRIVIAL_DESTRUCTOR
0037 # define BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
0038 #elif BOOST_WORKAROUND(BOOST_GCC, < 50000)
0039 # define BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
0040 #endif
0041
0042
0043 #if __cplusplus >= 201103L
0044 # if BOOST_WORKAROUND(BOOST_GCC, >= 50000)
0045 # define BOOST_OPTIONAL_DETAIL_USE_STD_TYPE_TRAITS
0046 # elif (defined BOOST_CLANG)
0047 # if BOOST_LIB_STD_CXX > 0
0048 # define BOOST_OPTIONAL_DETAIL_USE_STD_TYPE_TRAITS
0049 # elif BOOST_LIB_STD_GNU >= 441200023 && BOOST_LIB_STD_GNU != 450600023 && BOOST_LIB_STD_GNU != 450600026 && BOOST_LIB_STD_GNU != 460800003 && BOOST_LIB_STD_GNU != 450400026 && BOOST_LIB_STD_GNU != 460700026
0050 # define BOOST_OPTIONAL_DETAIL_USE_STD_TYPE_TRAITS
0051 # endif
0052 # endif
0053 #endif
0054
0055
0056 #ifndef BOOST_OPTIONAL_DETAIL_USE_STD_TYPE_TRAITS
0057 # define BOOST_OPTIONAL_DETAIL_HAS_TRIVIAL_CTOR(T) BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)
0058 #else
0059 # include <type_traits>
0060 # define BOOST_OPTIONAL_DETAIL_HAS_TRIVIAL_CTOR(T) std::is_trivially_default_constructible<T>::value
0061 #endif
0062
0063
0064 namespace boost { namespace optional_detail {
0065
0066 #ifndef BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
0067 template <typename T>
0068 struct is_type_trivially_copyable
0069 : boost::conditional<(boost::has_trivial_copy_constructor<T>::value &&
0070 boost::has_trivial_move_constructor<T>::value &&
0071 boost::has_trivial_destructor<T>::value &&
0072 boost::has_trivial_move_assign<T>::value &&
0073 boost::has_trivial_assign<T>::value),
0074 boost::true_type, boost::false_type>::type
0075 {};
0076 #else
0077 template <typename T>
0078 struct is_type_trivially_copyable
0079 : boost::conditional<(boost::is_scalar<T>::value && !boost::is_const<T>::value && !boost::is_volatile<T>::value),
0080 boost::true_type, boost::false_type>::type
0081 {};
0082 #endif
0083
0084
0085
0086 #ifndef BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
0087 template <typename T>
0088 struct optional_uses_direct_storage_for_
0089 : boost::conditional< (is_type_trivially_copyable<T>::value && BOOST_OPTIONAL_DETAIL_HAS_TRIVIAL_CTOR(T)) ||
0090 (boost::is_scalar<T>::value && !boost::is_const<T>::value && !boost::is_volatile<T>::value)
0091 , boost::true_type, boost::false_type>::type
0092 {};
0093 #else
0094 template <typename T>
0095 struct optional_uses_direct_storage_for_
0096 : boost::conditional<(boost::is_scalar<T>::value && !boost::is_const<T>::value && !boost::is_volatile<T>::value)
0097 , boost::true_type, boost::false_type>::type
0098 {};
0099 #endif
0100
0101
0102 }}
0103
0104 #endif