File indexing completed on 2025-01-18 09:40:53
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef BOOST_MOVE_DETAIL_TYPE_TRAITS_HPP
0017 #define BOOST_MOVE_DETAIL_TYPE_TRAITS_HPP
0018
0019 #ifndef BOOST_CONFIG_HPP
0020 # include <boost/config.hpp>
0021 #endif
0022 #
0023 #if defined(BOOST_HAS_PRAGMA_ONCE)
0024 # pragma once
0025 #endif
0026
0027 #include <boost/move/detail/config_begin.hpp>
0028 #include <boost/move/detail/workaround.hpp>
0029
0030
0031 #include <boost/move/detail/meta_utils.hpp>
0032
0033 #include <cassert>
0034
0035 #include <cstddef>
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074 #if defined(__MSL_CPP__) && (__MSL_CPP__ >= 0x8000)
0075
0076
0077
0078
0079 # include <msl_utility>
0080 # define BOOST_MOVE_IS_UNION(T) BOOST_STD_EXTENSION_NAMESPACE::is_union<T>::value
0081 # define BOOST_MOVE_IS_POD(T) BOOST_STD_EXTENSION_NAMESPACE::is_POD<T>::value
0082 # define BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) BOOST_STD_EXTENSION_NAMESPACE::has_trivial_default_ctor<T>::value
0083 # define BOOST_MOVE_HAS_TRIVIAL_COPY(T) BOOST_STD_EXTENSION_NAMESPACE::has_trivial_copy_ctor<T>::value
0084 # define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) BOOST_STD_EXTENSION_NAMESPACE::has_trivial_assignment<T>::value
0085 # define BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) BOOST_STD_EXTENSION_NAMESPACE::has_trivial_dtor<T>::value
0086 #endif
0087
0088 #if (defined(BOOST_MSVC) && defined(BOOST_MSVC_FULL_VER) && (BOOST_MSVC_FULL_VER >=140050215))\
0089 || (defined(BOOST_INTEL) && defined(_MSC_VER) && (_MSC_VER >= 1500))
0090 # define BOOST_MOVE_IS_UNION(T) __is_union(T)
0091 # define BOOST_MOVE_IS_POD(T) (__is_pod(T) && __has_trivial_constructor(T))
0092 # define BOOST_MOVE_IS_EMPTY(T) __is_empty(T)
0093 # define BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
0094 # define BOOST_MOVE_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T)|| ::boost::move_detail::is_pod<T>::value)
0095 # define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) || ::boost::move_detail::is_pod<T>::value)
0096 # define BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) || ::boost::move_detail::is_pod<T>::value)
0097 # define BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) || ::boost::move_detail::is_trivially_default_constructible<T>::value)
0098 # define BOOST_MOVE_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) || ::boost::move_detail::is_trivially_copy_constructible<T>::value)
0099 # define BOOST_MOVE_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) || ::boost::move_detail::is_trivially_copy_assignable<T>::value)
0100
0101 # define BOOST_MOVE_IS_ENUM(T) __is_enum(T)
0102 # if defined(_MSC_VER) && (_MSC_VER >= 1700)
0103 # define BOOST_MOVE_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) (__has_trivial_move_constructor(T) || ::boost::move_detail::is_pod<T>::value)
0104 # define BOOST_MOVE_HAS_TRIVIAL_MOVE_ASSIGN(T) (__has_trivial_move_assign(T) || ::boost::move_detail::is_pod<T>::value)
0105 # endif
0106 # if _MSC_FULL_VER >= 180020827
0107 # define BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN(T) (__is_nothrow_assignable(T&, T&&))
0108 # define BOOST_MOVE_HAS_NOTHROW_MOVE_CONSTRUCTOR(T) (__is_nothrow_constructible(T, T&&))
0109 # endif
0110 #endif
0111
0112 #if defined(BOOST_CLANG)
0113
0114 # if defined __is_identifier
0115 # define BOOST_MOVE_HAS_TRAIT(T) (__has_extension(T) || !__is_identifier(__##T))
0116 # elif defined(__has_extension)
0117 # define BOOST_MOVE_HAS_TRAIT(T) __has_extension(T)
0118 # else
0119 # define BOOST_MOVE_HAS_TRAIT(T) 0
0120 # endif
0121
0122
0123 # if BOOST_MOVE_HAS_TRAIT(is_union)
0124 # define BOOST_MOVE_IS_UNION(T) __is_union(T)
0125 # endif
0126
0127
0128 # if BOOST_MOVE_HAS_TRAIT(is_enum)
0129 # define BOOST_MOVE_IS_ENUM(T) __is_enum(T)
0130 # endif
0131
0132
0133 # if (!defined(__GLIBCXX__) || (__GLIBCXX__ >= 20080306 && __GLIBCXX__ != 20080519)) && BOOST_MOVE_HAS_TRAIT(is_pod)
0134 # define BOOST_MOVE_IS_POD(T) __is_pod(T)
0135 # endif
0136
0137
0138 # if (!defined(__GLIBCXX__) || (__GLIBCXX__ >= 20080306 && __GLIBCXX__ != 20080519)) && BOOST_MOVE_HAS_TRAIT(is_empty)
0139 # define BOOST_MOVE_IS_EMPTY(T) __is_empty(T)
0140 # endif
0141
0142
0143 # if BOOST_MOVE_HAS_TRAIT(is_constructible) && BOOST_MOVE_HAS_TRAIT(is_trivially_constructible)
0144 # define BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) __is_trivially_constructible(T)
0145 # elif BOOST_MOVE_HAS_TRAIT(has_trivial_constructor)
0146 # define BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
0147 # endif
0148
0149
0150 # if BOOST_MOVE_HAS_TRAIT(is_constructible) && BOOST_MOVE_HAS_TRAIT(is_trivially_constructible)
0151 # define BOOST_MOVE_HAS_TRIVIAL_COPY(T) (__is_constructible(T, const T &) && __is_trivially_constructible(T, const T &))
0152 # elif BOOST_MOVE_HAS_TRAIT(has_trivial_copy)
0153 # define BOOST_MOVE_HAS_TRIVIAL_COPY(T) __has_trivial_copy(T)
0154 # endif
0155
0156
0157 # if BOOST_MOVE_HAS_TRAIT(is_assignable) && BOOST_MOVE_HAS_TRAIT(is_trivially_assignable)
0158 # define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) (__is_assignable(T, const T &) && __is_trivially_assignable(T, const T &))
0159 # elif BOOST_MOVE_HAS_TRAIT(has_trivial_copy)
0160 # define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) __has_trivial_assign(T)
0161 # endif
0162
0163
0164 # if BOOST_MOVE_HAS_TRAIT(is_trivially_destructible)
0165 # define BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) __is_trivially_destructible(T)
0166 # elif BOOST_MOVE_HAS_TRAIT(has_trivial_destructor)
0167 # define BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
0168 # endif
0169
0170
0171 # if BOOST_MOVE_HAS_TRAIT(is_nothrow_constructible)
0172 # define BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR(T) __is_nothrow_constructible(T)
0173 # elif BOOST_MOVE_HAS_TRAIT(has_nothrow_constructor)
0174 # define BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T)
0175 # endif
0176
0177
0178 # if BOOST_MOVE_HAS_TRAIT(is_constructible) && BOOST_MOVE_HAS_TRAIT(is_nothrow_constructible)
0179 # define BOOST_MOVE_HAS_NOTHROW_COPY(T) (__is_constructible(T, const T &) && __is_nothrow_constructible(T, const T &))
0180 # elif BOOST_MOVE_HAS_TRAIT(has_nothrow_copy)
0181 # define BOOST_MOVE_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T))
0182 # endif
0183
0184
0185 # if BOOST_MOVE_HAS_TRAIT(is_assignable) && BOOST_MOVE_HAS_TRAIT(is_nothrow_assignable)
0186 # define BOOST_MOVE_HAS_NOTHROW_ASSIGN(T) (__is_assignable(T, const T &) && __is_nothrow_assignable(T, const T &))
0187 # elif BOOST_MOVE_HAS_TRAIT(has_nothrow_assign)
0188 # define BOOST_MOVE_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T))
0189 # endif
0190
0191
0192 # if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
0193
0194 # if BOOST_MOVE_HAS_TRAIT(is_constructible) && BOOST_MOVE_HAS_TRAIT(is_trivially_constructible)
0195 # define BOOST_MOVE_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) (__is_constructible(T, T&&) && __is_trivially_constructible(T, T&&))
0196 # elif BOOST_MOVE_HAS_TRAIT(has_trivial_move_constructor)
0197 # define BOOST_MOVE_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) __has_trivial_move_constructor(T)
0198 # endif
0199
0200
0201 # if BOOST_MOVE_HAS_TRAIT(is_assignable) && BOOST_MOVE_HAS_TRAIT(is_trivially_assignable)
0202 # define BOOST_MOVE_HAS_TRIVIAL_MOVE_ASSIGN(T) (__is_assignable(T, T&&) && __is_trivially_assignable(T, T&&))
0203 # elif BOOST_MOVE_HAS_TRAIT(has_trivial_move_assign)
0204 # define BOOST_MOVE_HAS_TRIVIAL_MOVE_ASSIGN(T) __has_trivial_move_assign(T)
0205 # endif
0206
0207
0208 # if BOOST_MOVE_HAS_TRAIT(is_constructible) && BOOST_MOVE_HAS_TRAIT(is_nothrow_constructible)
0209 # define BOOST_MOVE_HAS_NOTHROW_MOVE_CONSTRUCTOR(T) (__is_constructible(T, T&&) && __is_nothrow_constructible(T, T&&))
0210 # elif BOOST_MOVE_HAS_TRAIT(has_nothrow_move_constructor)
0211 # define BOOST_MOVE_HAS_NOTHROW_MOVE_CONSTRUCTOR(T) __has_nothrow_move_constructor(T)
0212 # endif
0213
0214
0215 # if BOOST_MOVE_HAS_TRAIT(is_assignable) && BOOST_MOVE_HAS_TRAIT(is_nothrow_assignable)
0216 # define BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN(T) (__is_assignable(T, T&&) && __is_nothrow_assignable(T, T&&))
0217 # elif BOOST_MOVE_HAS_TRAIT(has_nothrow_move_assign)
0218 # define BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN(T) __has_nothrow_move_assign(T)
0219 # endif
0220
0221 # endif
0222
0223
0224 # define BOOST_MOVE_ALIGNMENT_OF(T) __alignof(T)
0225
0226 #endif
0227
0228 #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) && !defined(__GCCXML__))) && !defined(BOOST_CLANG)
0229
0230 #ifdef BOOST_INTEL
0231 # define BOOST_MOVE_INTEL_TT_OPTS || ::boost::move_detail::is_pod<T>::value
0232 #else
0233 # define BOOST_MOVE_INTEL_TT_OPTS
0234 #endif
0235
0236 # define BOOST_MOVE_IS_UNION(T) __is_union(T)
0237 # define BOOST_MOVE_IS_POD(T) __is_pod(T)
0238 # define BOOST_MOVE_IS_EMPTY(T) __is_empty(T)
0239 # define BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) ((__has_trivial_constructor(T) BOOST_MOVE_INTEL_TT_OPTS))
0240
0241 # if defined(BOOST_GCC) && (BOOST_GCC > 50000)
0242 # define BOOST_MOVE_HAS_TRIVIAL_COPY(T) (__is_trivially_constructible(T, const T &))
0243 # define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) (__is_trivially_assignable(T, const T &))
0244 # else
0245 # define BOOST_MOVE_HAS_TRIVIAL_COPY(T) ((__has_trivial_copy(T) BOOST_MOVE_INTEL_TT_OPTS))
0246 # define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) ((__has_trivial_assign(T) BOOST_MOVE_INTEL_TT_OPTS) )
0247 # endif
0248
0249 # define BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) BOOST_MOVE_INTEL_TT_OPTS)
0250 # define BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) BOOST_MOVE_INTEL_TT_OPTS)
0251 # define BOOST_MOVE_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) BOOST_MOVE_INTEL_TT_OPTS))
0252 # define BOOST_MOVE_HAS_NOTHROW_ASSIGN(T) ((__has_nothrow_assign(T) BOOST_MOVE_INTEL_TT_OPTS))
0253
0254 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_SFINAE_EXPR)
0255
0256 template <typename T>
0257 T && boost_move_tt_declval() BOOST_NOEXCEPT;
0258
0259 # if defined(BOOST_GCC) && (BOOST_GCC >= 80000)
0260
0261 # define BOOST_MOVE_IS_ASSIGNABLE(T, U) __is_assignable(T, U)
0262 # define BOOST_MOVE_IS_CONSTRUCTIBLE(T, U) __is_constructible(T, U)
0263 # else
0264
0265 template<typename Tt, typename Ut>
0266 class boost_move_tt_is_assignable
0267 {
0268 struct twochar { char dummy[2]; };
0269 template < class T
0270 , class U
0271 , class = decltype(boost_move_tt_declval<T>() = boost_move_tt_declval<U>())
0272 > static char test(int);
0273
0274 template<class, class> static twochar test(...);
0275
0276 public:
0277 static const bool value = sizeof(test<Tt, Ut>(0)) == sizeof(char);
0278 };
0279
0280 template<typename Tt, typename Ut>
0281 class boost_move_tt_is_constructible
0282 {
0283 struct twochar { char dummy[2]; };
0284 template < class T
0285 , class U
0286 , class = decltype(T(boost_move_tt_declval<U>()))
0287 > static char test(int);
0288
0289 template<class, class> static twochar test(...);
0290
0291 public:
0292 static const bool value = sizeof(test<Tt, Ut>(0)) == sizeof(char);
0293 };
0294
0295 # define BOOST_MOVE_IS_ASSIGNABLE(T, U) boost_move_tt_is_assignable<T,U>::value
0296 # define BOOST_MOVE_IS_CONSTRUCTIBLE(T, U) boost_move_tt_is_constructible<T, U>::value
0297
0298 # endif
0299
0300 template <typename T, typename U, bool = BOOST_MOVE_IS_ASSIGNABLE(T, U)>
0301 struct boost_move_tt_is_nothrow_assignable
0302 {
0303 static const bool value = false;
0304 };
0305
0306 template <typename T, typename U>
0307 struct boost_move_tt_is_nothrow_assignable<T, U, true>
0308 {
0309 #if !defined(BOOST_NO_CXX11_NOEXCEPT)
0310 static const bool value = noexcept(boost_move_tt_declval<T>() = boost_move_tt_declval<U>());
0311 #else
0312 static const bool value = false;
0313 #endif
0314 };
0315
0316 template <typename T, typename U, bool = BOOST_MOVE_IS_CONSTRUCTIBLE(T, U)>
0317 struct boost_move_tt_is_nothrow_constructible
0318 {
0319 static const bool value = false;
0320 };
0321
0322 template <typename T, typename U>
0323 struct boost_move_tt_is_nothrow_constructible<T, U, true>
0324 {
0325 #if !defined(BOOST_NO_CXX11_NOEXCEPT)
0326 static const bool value = noexcept(T(boost_move_tt_declval<U>()));
0327 #else
0328 static const bool value = false;
0329 #endif
0330 };
0331
0332 # define BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN(T) boost_move_tt_is_nothrow_assignable<T, T&&>::value
0333 # define BOOST_MOVE_HAS_NOTHROW_MOVE_CONSTRUCTOR(T) boost_move_tt_is_nothrow_constructible<T, T&&>::value
0334
0335 # endif
0336
0337 # define BOOST_MOVE_IS_ENUM(T) __is_enum(T)
0338
0339
0340 # if (!defined(unix) && !defined(__unix__)) || defined(__LP64__)
0341
0342
0343
0344 # define BOOST_MOVE_ALIGNMENT_OF(T) __alignof__(T)
0345 # endif
0346 #endif
0347
0348 #if defined(__ghs__) && (__GHS_VERSION_NUMBER >= 600)
0349
0350 # define BOOST_MOVE_IS_UNION(T) __is_union(T)
0351 # define BOOST_MOVE_IS_POD(T) __is_pod(T)
0352 # define BOOST_MOVE_IS_EMPTY(T) __is_empty(T)
0353 # define BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
0354 # define BOOST_MOVE_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T))
0355 # define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T))
0356 # define BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
0357 # define BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T)
0358 # define BOOST_MOVE_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T))
0359 # define BOOST_MOVE_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T))
0360
0361 # define BOOST_MOVE_IS_ENUM(T) __is_enum(T)
0362 # define BOOST_MOVE_ALIGNMENT_OF(T) __alignof__(T)
0363 #endif
0364
0365 # if defined(BOOST_CODEGEARC)
0366 # define BOOST_MOVE_IS_UNION(T) __is_union(T)
0367 # define BOOST_MOVE_IS_POD(T) __is_pod(T)
0368 # define BOOST_MOVE_IS_EMPTY(T) __is_empty(T)
0369 # define BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) (__has_trivial_default_constructor(T))
0370 # define BOOST_MOVE_HAS_TRIVIAL_COPY(T) (__has_trivial_copy_constructor(T))
0371 # define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T))
0372 # define BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T))
0373 # define BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_default_constructor(T))
0374 # define BOOST_MOVE_HAS_NOTHROW_COPY(T) (__has_nothrow_copy_constructor(T))
0375 # define BOOST_MOVE_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T))
0376
0377 # define BOOST_MOVE_IS_ENUM(T) __is_enum(T)
0378 # define BOOST_MOVE_ALIGNMENT_OF(T) alignof(T)
0379
0380 #endif
0381
0382
0383
0384 #ifdef BOOST_MOVE_IS_UNION
0385 #define BOOST_MOVE_IS_UNION_IMPL(T) BOOST_MOVE_IS_UNION(T)
0386 #else
0387 #define BOOST_MOVE_IS_UNION_IMPL(T) false
0388 #endif
0389
0390 #ifdef BOOST_MOVE_IS_POD
0391
0392 #define BOOST_MOVE_IS_POD_IMPL(T) (::boost::move_detail::is_scalar<T>::value ||\
0393 ::boost::move_detail::is_void<T>::value ||\
0394 BOOST_MOVE_IS_POD(T))
0395 #else
0396 #define BOOST_MOVE_IS_POD_IMPL(T) \
0397 (::boost::move_detail::is_scalar<T>::value || ::boost::move_detail::is_void<T>::value)
0398 #endif
0399
0400 #ifdef BOOST_MOVE_IS_EMPTY
0401 #define BOOST_MOVE_IS_EMPTY_IMPL(T) BOOST_MOVE_IS_EMPTY(T)
0402 #else
0403 #define BOOST_MOVE_IS_EMPTY_IMPL(T) ::boost::move_detail::is_empty_nonintrinsic<T>::value
0404 #endif
0405
0406 #ifdef BOOST_MOVE_HAS_TRIVIAL_COPY
0407 #define BOOST_MOVE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) ::boost::move_detail::is_pod<T>::value ||\
0408 (::boost::move_detail::is_copy_constructible<T>::value &&\
0409 BOOST_MOVE_HAS_TRIVIAL_COPY(T))
0410 #else
0411 #define BOOST_MOVE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) ::boost::move_detail::is_pod<T>::value
0412 #endif
0413
0414 #ifdef BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR
0415 #define BOOST_MOVE_IS_TRIVIALLY_DEFAULT_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) || ::boost::move_detail::is_pod<T>::value
0416 #else
0417 #define BOOST_MOVE_IS_TRIVIALLY_DEFAULT_CONSTRUCTIBLE(T) ::boost::move_detail::is_pod<T>::value
0418 #endif
0419
0420 #ifdef BOOST_MOVE_HAS_TRIVIAL_MOVE_CONSTRUCTOR
0421 #define BOOST_MOVE_IS_TRIVIALLY_MOVE_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) || ::boost::move_detail::is_pod<T>::value
0422 #else
0423 #define BOOST_MOVE_IS_TRIVIALLY_MOVE_CONSTRUCTIBLE(T) ::boost::move_detail::is_pod<T>::value
0424 #endif
0425
0426 #ifdef BOOST_MOVE_HAS_TRIVIAL_ASSIGN
0427 #define BOOST_MOVE_IS_TRIVIALLY_COPY_ASSIGNABLE(T) ::boost::move_detail::is_pod<T>::value ||\
0428 ( ::boost::move_detail::is_copy_assignable<T>::value &&\
0429 BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T))
0430 #else
0431 #define BOOST_MOVE_IS_TRIVIALLY_COPY_ASSIGNABLE(T) ::boost::move_detail::is_pod<T>::value
0432 #endif
0433
0434 #ifdef BOOST_MOVE_HAS_TRIVIAL_MOVE_ASSIGN
0435 #define BOOST_MOVE_IS_TRIVIALLY_MOVE_ASSIGNABLE(T) BOOST_MOVE_HAS_TRIVIAL_MOVE_ASSIGN(T) || ::boost::move_detail::is_pod<T>::value
0436 #else
0437 #define BOOST_MOVE_IS_TRIVIALLY_MOVE_ASSIGNABLE(T) ::boost::move_detail::is_pod<T>::value
0438 #endif
0439
0440 #ifdef BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR
0441 #define BOOST_MOVE_IS_TRIVIALLY_DESTRUCTIBLE(T) BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) || ::boost::move_detail::is_pod<T>::value
0442 #else
0443 #define BOOST_MOVE_IS_TRIVIALLY_DESTRUCTIBLE(T) ::boost::move_detail::is_pod<T>::value
0444 #endif
0445
0446 #ifdef BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR
0447 #define BOOST_MOVE_IS_NOTHROW_DEFAULT_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR(T) || ::boost::move_detail::is_pod<T>::value
0448 #else
0449 #define BOOST_MOVE_IS_NOTHROW_DEFAULT_CONSTRUCTIBLE(T) ::boost::move_detail::is_pod<T>::value
0450 #endif
0451
0452 #ifdef BOOST_MOVE_HAS_NOTHROW_COPY
0453 #define BOOST_MOVE_IS_NOTHROW_COPY_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_NOTHROW_COPY(T) || ::boost::move_detail::is_pod<T>::value
0454 #else
0455 #define BOOST_MOVE_IS_NOTHROW_COPY_CONSTRUCTIBLE(T) BOOST_MOVE_IS_TRIVIALLY_COPY_ASSIGNABLE(T)
0456 #endif
0457
0458 #ifdef BOOST_MOVE_HAS_NOTHROW_ASSIGN
0459 #define BOOST_MOVE_IS_NOTHROW_COPY_ASSIGNABLE(T) BOOST_MOVE_HAS_NOTHROW_ASSIGN(T) || ::boost::move_detail::is_pod<T>::value
0460 #else
0461 #define BOOST_MOVE_IS_NOTHROW_COPY_ASSIGNABLE(T) BOOST_MOVE_IS_TRIVIALLY_COPY_ASSIGNABLE(T)
0462 #endif
0463
0464 #ifdef BOOST_MOVE_HAS_NOTHROW_MOVE_CONSTRUCTOR
0465 #define BOOST_MOVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_NOTHROW_MOVE_CONSTRUCTOR(T) || ::boost::move_detail::is_pod<T>::value
0466 #else
0467 #define BOOST_MOVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE(T) BOOST_MOVE_IS_TRIVIALLY_MOVE_ASSIGNABLE(T)
0468 #endif
0469
0470 #ifdef BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN
0471 #define BOOST_MOVE_IS_NOTHROW_MOVE_ASSIGNABLE(T) BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN(T) || ::boost::move_detail::is_pod<T>::value
0472 #else
0473 #define BOOST_MOVE_IS_NOTHROW_MOVE_ASSIGNABLE(T) BOOST_MOVE_IS_TRIVIALLY_MOVE_ASSIGNABLE(T)
0474 #endif
0475
0476 #ifdef BOOST_MOVE_IS_ENUM
0477 #define BOOST_MOVE_IS_ENUM_IMPL(T) BOOST_MOVE_IS_ENUM(T)
0478 #else
0479 #define BOOST_MOVE_IS_ENUM_IMPL(T) ::boost::move_detail::is_enum_nonintrinsic<T>::value
0480 #endif
0481
0482 namespace boost {
0483 namespace move_detail {
0484
0485
0486
0487
0488 template<class T>
0489 struct is_reference
0490 { static const bool value = false; };
0491
0492 template<class T>
0493 struct is_reference<T&>
0494 { static const bool value = true; };
0495
0496 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
0497 template<class T>
0498 struct is_reference<T&&>
0499 { static const bool value = true; };
0500 #endif
0501
0502
0503
0504
0505 template<class T>
0506 struct is_pointer
0507 { static const bool value = false; };
0508
0509 template<class T>
0510 struct is_pointer<T*>
0511 { static const bool value = true; };
0512
0513
0514
0515
0516 template<class T>
0517 struct is_const
0518 { static const bool value = false; };
0519
0520 template<class T>
0521 struct is_const<const T>
0522 { static const bool value = true; };
0523
0524
0525
0526
0527 template <typename T> struct unvoid_ref : add_lvalue_reference<T>{};
0528 template <> struct unvoid_ref<void> { typedef unvoid_ref & type; };
0529 template <> struct unvoid_ref<const void> { typedef unvoid_ref & type; };
0530 template <> struct unvoid_ref<volatile void> { typedef unvoid_ref & type; };
0531 template <> struct unvoid_ref<const volatile void> { typedef unvoid_ref & type; };
0532
0533 template <typename T>
0534 struct add_reference : add_lvalue_reference<T>
0535 {};
0536
0537
0538
0539
0540 template <class T>
0541 struct add_const_reference
0542 { typedef const T &type; };
0543
0544 template <class T>
0545 struct add_const_reference<T&>
0546 { typedef T& type; };
0547
0548
0549
0550
0551 template<class T, bool Add>
0552 struct add_const_if_c
0553 : if_c<Add, typename add_const<T>::type, T>
0554 {};
0555
0556
0557
0558
0559 template<class T>
0560 struct remove_const
0561 { typedef T type; };
0562
0563 template<class T>
0564 struct remove_const< const T>
0565 { typedef T type; };
0566
0567
0568
0569
0570 template<typename T> struct remove_cv { typedef T type; };
0571 template<typename T> struct remove_cv<const T> { typedef T type; };
0572 template<typename T> struct remove_cv<const volatile T> { typedef T type; };
0573 template<typename T> struct remove_cv<volatile T> { typedef T type; };
0574
0575
0576
0577
0578 template<class T>
0579 struct remove_cvref
0580 : remove_cv<typename remove_reference<T>::type>
0581 {
0582 };
0583
0584
0585
0586
0587 template <class T>
0588 struct make_unsigned_impl { typedef T type; };
0589 template <> struct make_unsigned_impl<signed char> { typedef unsigned char type; };
0590 template <> struct make_unsigned_impl<signed short> { typedef unsigned short type; };
0591 template <> struct make_unsigned_impl<signed int> { typedef unsigned int type; };
0592 template <> struct make_unsigned_impl<signed long> { typedef unsigned long type; };
0593 #ifdef BOOST_HAS_LONG_LONG
0594 template <> struct make_unsigned_impl< ::boost::long_long_type > { typedef ::boost::ulong_long_type type; };
0595 #endif
0596
0597 template <class T>
0598 struct make_unsigned
0599 : make_unsigned_impl<typename remove_cv<T>::type>
0600 {};
0601
0602
0603
0604
0605 template<class T> struct is_floating_point_cv { static const bool value = false; };
0606 template<> struct is_floating_point_cv<float> { static const bool value = true; };
0607 template<> struct is_floating_point_cv<double> { static const bool value = true; };
0608 template<> struct is_floating_point_cv<long double> { static const bool value = true; };
0609
0610 template<class T>
0611 struct is_floating_point
0612 : is_floating_point_cv<typename remove_cv<T>::type>
0613 {};
0614
0615
0616
0617
0618 template<class T> struct is_integral_cv { static const bool value = false; };
0619 template<> struct is_integral_cv< bool>{ static const bool value = true; };
0620 template<> struct is_integral_cv< char>{ static const bool value = true; };
0621 template<> struct is_integral_cv< unsigned char>{ static const bool value = true; };
0622 template<> struct is_integral_cv< signed char>{ static const bool value = true; };
0623 #ifndef BOOST_NO_CXX11_CHAR16_T
0624 template<> struct is_integral_cv< char16_t>{ static const bool value = true; };
0625 #endif
0626 #ifndef BOOST_NO_CXX11_CHAR32_T
0627 template<> struct is_integral_cv< char32_t>{ static const bool value = true; };
0628 #endif
0629 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
0630 template<> struct is_integral_cv< wchar_t>{ static const bool value = true; };
0631 #endif
0632 template<> struct is_integral_cv< short>{ static const bool value = true; };
0633 template<> struct is_integral_cv< unsigned short>{ static const bool value = true; };
0634 template<> struct is_integral_cv< int>{ static const bool value = true; };
0635 template<> struct is_integral_cv< unsigned int>{ static const bool value = true; };
0636 template<> struct is_integral_cv< long>{ static const bool value = true; };
0637 template<> struct is_integral_cv< unsigned long>{ static const bool value = true; };
0638 #ifdef BOOST_HAS_LONG_LONG
0639 template<> struct is_integral_cv< ::boost:: long_long_type>{ static const bool value = true; };
0640 template<> struct is_integral_cv< ::boost::ulong_long_type>{ static const bool value = true; };
0641 #endif
0642
0643 template<class T>
0644 struct is_integral
0645 : public is_integral_cv<typename remove_cv<T>::type>
0646 {};
0647
0648
0649
0650
0651 template <class T>
0652 struct remove_all_extents
0653 { typedef T type;};
0654
0655 template <class T>
0656 struct remove_all_extents<T[]>
0657 { typedef typename remove_all_extents<T>::type type; };
0658
0659 template <class T, std::size_t N>
0660 struct remove_all_extents<T[N]>
0661 { typedef typename remove_all_extents<T>::type type;};
0662
0663
0664
0665
0666 template<class T>
0667 struct is_scalar
0668 { static const bool value = is_integral<T>::value || is_floating_point<T>::value; };
0669
0670
0671
0672
0673 template<class T>
0674 struct is_void_cv
0675 { static const bool value = false; };
0676
0677 template<>
0678 struct is_void_cv<void>
0679 { static const bool value = true; };
0680
0681 template<class T>
0682 struct is_void
0683 : is_void_cv<typename remove_cv<T>::type>
0684 {};
0685
0686
0687
0688
0689 template<class T>
0690 struct is_array
0691 { static const bool value = false; };
0692
0693 template<class T>
0694 struct is_array<T[]>
0695 { static const bool value = true; };
0696
0697 template<class T, std::size_t N>
0698 struct is_array<T[N]>
0699 { static const bool value = true; };
0700
0701
0702
0703
0704 template <class T> struct is_member_pointer_cv { static const bool value = false; };
0705 template <class T, class U>struct is_member_pointer_cv<T U::*> { static const bool value = true; };
0706
0707 template <class T>
0708 struct is_member_pointer
0709 : is_member_pointer_cv<typename remove_cv<T>::type>
0710 {};
0711
0712
0713
0714
0715 template <class T>
0716 struct is_nullptr_t_cv
0717 { static const bool value = false; };
0718
0719 #if !defined(BOOST_NO_CXX11_NULLPTR)
0720 template <>
0721 struct is_nullptr_t_cv
0722 #if !defined(BOOST_NO_CXX11_DECLTYPE)
0723 <decltype(nullptr)>
0724 #else
0725 <std::nullptr_t>
0726 #endif
0727 { static const bool value = true; };
0728 #endif
0729
0730 template <class T>
0731 struct is_nullptr_t
0732 : is_nullptr_t_cv<typename remove_cv<T>::type>
0733 {};
0734
0735
0736
0737
0738
0739
0740
0741
0742 template <class T>
0743 struct is_reference_convertible_to_pointer
0744 {
0745 struct twochar { char dummy[2]; };
0746 template <class U> static char test(U*);
0747 template <class U> static twochar test(...);
0748 static T& source();
0749 static const bool value = sizeof(char) == sizeof(test<T>(source()));
0750 };
0751
0752
0753
0754
0755
0756 template < class T
0757 , bool Filter = is_class_or_union<T>::value ||
0758 is_void<T>::value ||
0759 is_reference<T>::value ||
0760 is_nullptr_t<T>::value >
0761 struct is_function_impl
0762 { static const bool value = is_reference_convertible_to_pointer<T>::value; };
0763
0764 template <class T>
0765 struct is_function_impl<T, true>
0766 { static const bool value = false; };
0767
0768 template <class T>
0769 struct is_function
0770 : is_function_impl<T>
0771 {};
0772
0773
0774
0775
0776 template<class T>
0777 struct is_union_noextents_cv
0778 { static const bool value = BOOST_MOVE_IS_UNION_IMPL(T); };
0779
0780 template<class T>
0781 struct is_union
0782 : is_union_noextents_cv<typename remove_cv<typename remove_all_extents<T>::type>::type>
0783 {};
0784
0785
0786
0787
0788 template <class T>
0789 struct is_class
0790 {
0791 static const bool value = is_class_or_union<T>::value && ! is_union<T>::value;
0792 };
0793
0794
0795
0796
0797
0798 template <class T>
0799 struct is_arithmetic
0800 {
0801 static const bool value = is_floating_point<T>::value ||
0802 is_integral<T>::value;
0803 };
0804
0805
0806
0807
0808 template <class T>
0809 struct is_member_function_pointer_cv
0810 {
0811 static const bool value = false;
0812 };
0813
0814 template <class T, class C>
0815 struct is_member_function_pointer_cv<T C::*>
0816 : is_function<T>
0817 {};
0818
0819 template <class T>
0820 struct is_member_function_pointer
0821 : is_member_function_pointer_cv<typename remove_cv<T>::type>
0822 {};
0823
0824
0825
0826
0827 #if !defined(BOOST_MOVE_IS_ENUM)
0828
0829 template <class T>
0830 struct is_enum_nonintrinsic
0831 {
0832 static const bool value = !is_arithmetic<T>::value &&
0833 !is_reference<T>::value &&
0834 !is_class_or_union<T>::value &&
0835 !is_array<T>::value &&
0836 !is_void<T>::value &&
0837 !is_nullptr_t<T>::value &&
0838 !is_member_pointer<T>::value &&
0839 !is_pointer<T>::value &&
0840 !is_function<T>::value;
0841 };
0842 #endif
0843
0844 template <class T>
0845 struct is_enum
0846 { static const bool value = BOOST_MOVE_IS_ENUM_IMPL(T); };
0847
0848
0849
0850
0851 template<class T>
0852 struct is_pod_noextents_cv
0853 { static const bool value = BOOST_MOVE_IS_POD_IMPL(T); };
0854
0855 template<class T>
0856 struct is_pod
0857 : is_pod_noextents_cv<typename remove_cv<typename remove_all_extents<T>::type>::type>
0858 {};
0859
0860
0861
0862
0863 #if !defined(BOOST_MOVE_IS_EMPTY)
0864
0865 template <typename T>
0866 struct empty_helper_t1 : public T
0867 {
0868 empty_helper_t1();
0869 int i[256];
0870 private:
0871
0872 empty_helper_t1(const empty_helper_t1&);
0873 empty_helper_t1& operator=(const empty_helper_t1&);
0874 };
0875
0876 struct empty_helper_t2 { int i[256]; };
0877
0878 template <typename T, bool IsClass = is_class<T>::value >
0879 struct is_empty_nonintrinsic
0880 {
0881 static const bool value = false;
0882 };
0883
0884 template <typename T>
0885 struct is_empty_nonintrinsic<T, true>
0886 {
0887 static const bool value = sizeof(empty_helper_t1<T>) == sizeof(empty_helper_t2);
0888 };
0889 #endif
0890
0891 template <class T>
0892 struct is_empty
0893 { static const bool value = BOOST_MOVE_IS_EMPTY_IMPL(T); };
0894
0895
0896 template<class T>
0897 struct has_boost_move_no_copy_constructor_or_assign_type
0898 {
0899 template <class U>
0900 static yes_type test(typename U::boost_move_no_copy_constructor_or_assign*);
0901
0902 template <class U>
0903 static no_type test(...);
0904
0905 static const bool value = sizeof(test<T>(0)) == sizeof(yes_type);
0906 };
0907
0908
0909
0910
0911 #if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(BOOST_NO_CXX11_DECLTYPE) \
0912 && !defined(BOOST_INTEL_CXX_VERSION) && \
0913 !(defined(BOOST_MSVC) && _MSC_VER == 1800)
0914 #define BOOST_MOVE_TT_CXX11_IS_COPY_CONSTRUCTIBLE
0915 #endif
0916
0917 template<class T>
0918 struct is_copy_constructible
0919 {
0920
0921
0922
0923
0924
0925
0926
0927 #if defined(BOOST_MOVE_TT_CXX11_IS_COPY_CONSTRUCTIBLE)
0928 template<class U> static typename add_reference<U>::type source();
0929 static no_type test(...);
0930 #ifdef BOOST_NO_CXX11_DECLTYPE
0931 template <class U>
0932 static yes_type test(U&, bool_<sizeof(U(source<U>()))>* = 0);
0933 #else
0934 template <class U>
0935 static yes_type test(U&, decltype(U(source<U>()))* = 0);
0936 #endif
0937 static const bool value = sizeof(test(source<T>())) == sizeof(yes_type);
0938 #else
0939 static const bool value = !has_boost_move_no_copy_constructor_or_assign_type<T>::value;
0940 #endif
0941 };
0942
0943
0944
0945
0946
0947 #if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(BOOST_NO_CXX11_DECLTYPE) \
0948 && !defined(BOOST_INTEL_CXX_VERSION) && \
0949 !(defined(BOOST_MSVC) && _MSC_VER == 1800)
0950 #define BOOST_MOVE_TT_CXX11_IS_COPY_ASSIGNABLE
0951 #endif
0952
0953 template <class T>
0954 struct is_copy_assignable
0955 {
0956
0957
0958
0959
0960
0961
0962
0963
0964 #if defined(BOOST_MOVE_TT_CXX11_IS_COPY_ASSIGNABLE)
0965 typedef char yes_type;
0966 struct no_type { char dummy[2]; };
0967
0968 template <class U> static typename add_reference<U>::type source();
0969 template <class U> static decltype(source<U&>() = source<const U&>(), yes_type() ) test(int);
0970 template <class> static no_type test(...);
0971
0972 static const bool value = sizeof(test<T>(0)) == sizeof(yes_type);
0973 #else
0974 static const bool value = !has_boost_move_no_copy_constructor_or_assign_type<T>::value;
0975 #endif
0976 };
0977
0978
0979
0980
0981 template<class T>
0982 struct is_trivially_destructible
0983 { static const bool value = BOOST_MOVE_IS_TRIVIALLY_DESTRUCTIBLE(T); };
0984
0985
0986
0987
0988 template<class T>
0989 struct is_trivially_default_constructible
0990 { static const bool value = BOOST_MOVE_IS_TRIVIALLY_DEFAULT_CONSTRUCTIBLE(T); };
0991
0992
0993
0994
0995 template<class T>
0996 struct is_trivially_copy_constructible
0997 {
0998 static const bool value = BOOST_MOVE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T);
0999 };
1000
1001
1002
1003
1004 template<class T>
1005 struct is_trivially_move_constructible
1006 { static const bool value = BOOST_MOVE_IS_TRIVIALLY_MOVE_CONSTRUCTIBLE(T); };
1007
1008
1009
1010
1011 template<class T>
1012 struct is_trivially_copy_assignable
1013 {
1014 static const bool value = BOOST_MOVE_IS_TRIVIALLY_COPY_ASSIGNABLE(T);
1015 };
1016
1017
1018
1019
1020 template<class T>
1021 struct is_trivially_move_assignable
1022 { static const bool value = BOOST_MOVE_IS_TRIVIALLY_MOVE_ASSIGNABLE(T); };
1023
1024
1025
1026
1027 template<class T>
1028 struct is_nothrow_default_constructible
1029 { static const bool value = BOOST_MOVE_IS_NOTHROW_DEFAULT_CONSTRUCTIBLE(T); };
1030
1031
1032
1033
1034 template<class T>
1035 struct is_nothrow_copy_constructible
1036 { static const bool value = BOOST_MOVE_IS_NOTHROW_COPY_CONSTRUCTIBLE(T); };
1037
1038
1039
1040
1041 template<class T>
1042 struct is_nothrow_move_constructible
1043 { static const bool value = BOOST_MOVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE(T); };
1044
1045
1046
1047
1048 template<class T>
1049 struct is_nothrow_copy_assignable
1050 { static const bool value = BOOST_MOVE_IS_NOTHROW_COPY_ASSIGNABLE(T); };
1051
1052
1053
1054
1055 template<class T>
1056 struct is_nothrow_move_assignable
1057 { static const bool value = BOOST_MOVE_IS_NOTHROW_MOVE_ASSIGNABLE(T); };
1058
1059
1060
1061
1062 template<class T>
1063 struct is_nothrow_swappable
1064 {
1065 static const bool value = is_empty<T>::value || is_pod<T>::value;
1066 };
1067
1068
1069
1070
1071 template <typename T>
1072 struct alignment_of_hack
1073 {
1074 T t1;
1075 char c;
1076 T t2;
1077 alignment_of_hack();
1078 ~alignment_of_hack();
1079 };
1080
1081 template <unsigned A, unsigned S>
1082 struct alignment_logic
1083 { static const std::size_t value = A < S ? A : S; };
1084
1085 template< typename T >
1086 struct alignment_of_impl
1087 #if defined(BOOST_MSVC) && (BOOST_MSVC >= 1400)
1088
1089
1090
1091 : alignment_logic< sizeof(alignment_of_hack<T>) - 2*sizeof(T), __alignof(T)>
1092 {};
1093 #elif !defined(BOOST_MOVE_ALIGNMENT_OF)
1094 : alignment_logic< sizeof(alignment_of_hack<T>) - 2*sizeof(T), sizeof(T)>
1095 {};
1096 #else
1097 { static const std::size_t value = BOOST_MOVE_ALIGNMENT_OF(T); };
1098 #endif
1099
1100 template< typename T >
1101 struct alignment_of
1102 : alignment_of_impl<T>
1103 {};
1104
1105 class alignment_dummy;
1106 typedef void (*function_ptr)();
1107 typedef int (alignment_dummy::*member_ptr);
1108
1109 struct alignment_struct
1110 { long double dummy[4]; };
1111
1112
1113
1114
1115
1116 union max_align
1117 {
1118 char char_;
1119 short short_;
1120 int int_;
1121 long long_;
1122 #ifdef BOOST_HAS_LONG_LONG
1123 ::boost::long_long_type long_long_;
1124 #endif
1125 float float_;
1126 double double_;
1127 void * void_ptr_;
1128 long double long_double_[4];
1129 alignment_dummy *unknown_class_ptr_;
1130 function_ptr function_ptr_;
1131 alignment_struct alignment_struct_;
1132 };
1133
1134 typedef union max_align max_align_t;
1135
1136
1137
1138
1139
1140 #if defined(_MSC_VER) && defined(_M_IX86)
1141
1142
1143
1144 template<std::size_t Align>
1145 struct aligned_struct;
1146
1147 template <> struct aligned_struct<1> { char data; };
1148 template <> struct aligned_struct<2> { short data; };
1149 template <> struct aligned_struct<4> { int data; };
1150 template <> struct aligned_struct<8> { double data; };
1151
1152 #define BOOST_MOVE_ALIGNED_STRUCT(x) \
1153 template <> struct aligned_struct<x> { \
1154 __declspec(align(x)) char data; \
1155 }
1156 BOOST_MOVE_ALIGNED_STRUCT(16);
1157 BOOST_MOVE_ALIGNED_STRUCT(32);
1158 BOOST_MOVE_ALIGNED_STRUCT(64);
1159 BOOST_MOVE_ALIGNED_STRUCT(128);
1160 BOOST_MOVE_ALIGNED_STRUCT(512);
1161 BOOST_MOVE_ALIGNED_STRUCT(1024);
1162 BOOST_MOVE_ALIGNED_STRUCT(2048);
1163 BOOST_MOVE_ALIGNED_STRUCT(4096);
1164
1165 template<std::size_t Len, std::size_t Align>
1166 union aligned_union
1167 {
1168 typedef aligned_struct<Align> aligner_t;
1169 aligner_t aligner;
1170 unsigned char data[Len > sizeof(aligner_t) ? Len : sizeof(aligner_t)];
1171 };
1172
1173 template<std::size_t Len, std::size_t Align>
1174 struct aligned_storage_impl
1175 {
1176 typedef aligned_union<Len, Align> type;
1177 };
1178
1179 #elif !defined(BOOST_NO_ALIGNMENT)
1180
1181 template<std::size_t Len, std::size_t Align>
1182 struct aligned_struct;
1183
1184 #define BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(A)\
1185 template<std::size_t Len>\
1186 struct BOOST_ALIGNMENT(A) aligned_struct<Len, A>\
1187 {\
1188 unsigned char data[Len];\
1189 };\
1190
1191
1192
1193 BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x1)
1194 BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x2)
1195 BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x4)
1196 BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x8)
1197 BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x10)
1198 BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x20)
1199 BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x40)
1200 BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x80)
1201 BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x100)
1202 BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x200)
1203 BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x400)
1204 BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x800)
1205 BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x1000)
1206
1207 #undef BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT
1208
1209
1210
1211 template<std::size_t Len, std::size_t Align>
1212 union aligned_struct_wrapper
1213 {
1214 typedef aligned_struct<Len, Align> aligner_t;
1215 aligned_struct<Len, Align> aligner;
1216 unsigned char data[Len > sizeof(aligner_t) ? Len : sizeof(aligner_t)];
1217 };
1218
1219 template<std::size_t Len, std::size_t Align>
1220 struct aligned_storage_impl
1221 {
1222 typedef aligned_struct_wrapper<Len, Align> type;
1223 };
1224
1225 #else
1226
1227 template<class T, std::size_t Len>
1228 union aligned_union
1229 {
1230 T aligner;
1231 unsigned char data[Len > sizeof(T) ? Len : sizeof(T)];
1232 };
1233
1234 template<std::size_t Len, std::size_t Align, class T, bool Ok>
1235 struct aligned_next;
1236
1237 template<std::size_t Len, std::size_t Align, class T>
1238 struct aligned_next<Len, Align, T, true>
1239 {
1240 BOOST_MOVE_STATIC_ASSERT((alignment_of<T>::value == Align));
1241 typedef aligned_union<T, Len> type;
1242 };
1243
1244
1245 template<std::size_t Len, std::size_t Align>
1246 struct aligned_next<Len, Align, max_align_t, false>
1247 { typedef aligned_union<max_align_t, Len> type; };
1248
1249
1250 #define BOOST_MOVE_ALIGNED_NEXT_STEP(TYPE, NEXT_TYPE)\
1251 template<std::size_t Len, std::size_t Align>\
1252 struct aligned_next<Len, Align, TYPE, false>\
1253 : aligned_next<Len, Align, NEXT_TYPE, Align == alignment_of<NEXT_TYPE>::value>\
1254 {};\
1255
1256 BOOST_MOVE_ALIGNED_NEXT_STEP(long double, max_align_t)
1257 BOOST_MOVE_ALIGNED_NEXT_STEP(double, long double)
1258 #ifdef BOOST_HAS_LONG_LONG
1259 BOOST_MOVE_ALIGNED_NEXT_STEP(::boost::long_long_type, double)
1260 BOOST_MOVE_ALIGNED_NEXT_STEP(long, ::boost::long_long_type)
1261 #else
1262 BOOST_MOVE_ALIGNED_NEXT_STEP(long, double)
1263 #endif
1264 BOOST_MOVE_ALIGNED_NEXT_STEP(int, long)
1265 BOOST_MOVE_ALIGNED_NEXT_STEP(short, int)
1266 BOOST_MOVE_ALIGNED_NEXT_STEP(char, short)
1267 #undef BOOST_MOVE_ALIGNED_NEXT_STEP
1268
1269 template<std::size_t Len, std::size_t Align>
1270 struct aligned_storage_impl
1271 : aligned_next<Len, Align, char, Align == alignment_of<char>::value>
1272 {};
1273
1274 #endif
1275
1276 template<std::size_t Len, std::size_t Align = alignment_of<max_align_t>::value>
1277 struct aligned_storage
1278 {
1279
1280 BOOST_MOVE_STATIC_ASSERT(Align > 0);
1281
1282
1283 typedef typename aligned_storage_impl<Len ? Len : 1, Align>::type type;
1284 static const std::size_t value = alignment_of<type>::value;
1285 BOOST_MOVE_STATIC_ASSERT(value >= Align);
1286 BOOST_MOVE_STATIC_ASSERT((value % Align) == 0);
1287
1288
1289
1290 private:
1291 aligned_storage();
1292 };
1293
1294 }
1295 }
1296
1297 #include <boost/move/detail/config_end.hpp>
1298
1299 #endif