File indexing completed on 2025-01-18 09:40:53
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef BOOST_MOVE_UNIQUE_PTR_DETAIL_META_UTILS_HPP
0015 #define BOOST_MOVE_UNIQUE_PTR_DETAIL_META_UTILS_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 <cstddef> //for std::size_t
0026
0027
0028
0029 namespace boost {
0030
0031 namespace movelib {
0032
0033 template <class T>
0034 struct default_delete;
0035
0036 }
0037
0038 #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
0039
0040 template <class T> class rv;
0041 #endif
0042
0043 namespace move_upmu {
0044
0045
0046
0047
0048 struct nat{};
0049
0050
0051
0052
0053 template <class T> struct natify{};
0054
0055
0056
0057
0058 template<bool C, typename T1, typename T2>
0059 struct if_c
0060 {
0061 typedef T1 type;
0062 };
0063
0064 template<typename T1, typename T2>
0065 struct if_c<false,T1,T2>
0066 {
0067 typedef T2 type;
0068 };
0069
0070
0071
0072
0073 template<typename T1, typename T2, typename T3>
0074 struct if_ : if_c<0 != T1::value, T2, T3>
0075 {};
0076
0077
0078 template <bool B, class T = nat>
0079 struct enable_if_c
0080 {
0081 typedef T type;
0082 };
0083
0084
0085
0086
0087 template <class T>
0088 struct enable_if_c<false, T> {};
0089
0090
0091
0092
0093 template <class Cond, class T = nat>
0094 struct enable_if : public enable_if_c<Cond::value, T> {};
0095
0096
0097
0098
0099 template<class T>
0100 struct remove_reference
0101 {
0102 typedef T type;
0103 };
0104
0105 template<class T>
0106 struct remove_reference<T&>
0107 {
0108 typedef T type;
0109 };
0110
0111 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
0112
0113 template<class T>
0114 struct remove_reference<T&&>
0115 {
0116 typedef T type;
0117 };
0118
0119 #else
0120
0121 template<class T>
0122 struct remove_reference< rv<T> >
0123 {
0124 typedef T type;
0125 };
0126
0127 template<class T>
0128 struct remove_reference< rv<T> &>
0129 {
0130 typedef T type;
0131 };
0132
0133 template<class T>
0134 struct remove_reference< const rv<T> &>
0135 {
0136 typedef T type;
0137 };
0138
0139
0140 #endif
0141
0142
0143
0144
0145 template< class T >
0146 struct remove_const
0147 {
0148 typedef T type;
0149 };
0150
0151 template< class T >
0152 struct remove_const<const T>
0153 {
0154 typedef T type;
0155 };
0156
0157
0158
0159
0160 template< class T >
0161 struct remove_volatile
0162 {
0163 typedef T type;
0164 };
0165
0166 template< class T >
0167 struct remove_volatile<volatile T>
0168 {
0169 typedef T type;
0170 };
0171
0172
0173
0174
0175 template< class T >
0176 struct remove_cv
0177 {
0178 typedef typename remove_volatile
0179 <typename remove_const<T>::type>::type type;
0180 };
0181
0182
0183
0184
0185 template<class T>
0186 struct remove_extent
0187 {
0188 typedef T type;
0189 };
0190
0191 template<class T>
0192 struct remove_extent<T[]>
0193 {
0194 typedef T type;
0195 };
0196
0197 template<class T, std::size_t N>
0198 struct remove_extent<T[N]>
0199 {
0200 typedef T type;
0201 };
0202
0203
0204
0205
0206
0207 template<class T, unsigned N = 0>
0208 struct extent
0209 {
0210 static const std::size_t value = 0;
0211 };
0212
0213 template<class T>
0214 struct extent<T[], 0>
0215 {
0216 static const std::size_t value = 0;
0217 };
0218
0219 template<class T, unsigned N>
0220 struct extent<T[], N>
0221 {
0222 static const std::size_t value = extent<T, N-1>::value;
0223 };
0224
0225 template<class T, std::size_t N>
0226 struct extent<T[N], 0>
0227 {
0228 static const std::size_t value = N;
0229 };
0230
0231 template<class T, std::size_t I, unsigned N>
0232 struct extent<T[I], N>
0233 {
0234 static const std::size_t value = extent<T, N-1>::value;
0235 };
0236
0237
0238
0239
0240 template<class T>
0241 struct add_lvalue_reference
0242 {
0243 typedef T& type;
0244 };
0245
0246 template<class T>
0247 struct add_lvalue_reference<T&>
0248 {
0249 typedef T& type;
0250 };
0251
0252 template<>
0253 struct add_lvalue_reference<void>
0254 {
0255 typedef void type;
0256 };
0257
0258 template<>
0259 struct add_lvalue_reference<const void>
0260 {
0261 typedef const void type;
0262 };
0263
0264 template<>
0265 struct add_lvalue_reference<volatile void>
0266 {
0267 typedef volatile void type;
0268 };
0269
0270 template<>
0271 struct add_lvalue_reference<const volatile void>
0272 {
0273 typedef const volatile void type;
0274 };
0275
0276 template<class T>
0277 struct add_const_lvalue_reference
0278 {
0279 typedef typename remove_reference<T>::type t_unreferenced;
0280 typedef const t_unreferenced t_unreferenced_const;
0281 typedef typename add_lvalue_reference
0282 <t_unreferenced_const>::type type;
0283 };
0284
0285
0286
0287
0288 template<class T, class U>
0289 struct is_same
0290 {
0291 static const bool value = false;
0292 };
0293
0294 template<class T>
0295 struct is_same<T, T>
0296 {
0297 static const bool value = true;
0298 };
0299
0300
0301
0302
0303 template< class T >
0304 struct is_pointer
0305 {
0306 static const bool value = false;
0307 };
0308
0309 template< class T >
0310 struct is_pointer<T*>
0311 {
0312 static const bool value = true;
0313 };
0314
0315
0316
0317
0318 template< class T >
0319 struct is_reference
0320 {
0321 static const bool value = false;
0322 };
0323
0324 template< class T >
0325 struct is_reference<T&>
0326 {
0327 static const bool value = true;
0328 };
0329
0330 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
0331
0332 template< class T >
0333 struct is_reference<T&&>
0334 {
0335 static const bool value = true;
0336 };
0337
0338 #endif
0339
0340
0341
0342
0343 template<class T>
0344 struct is_lvalue_reference
0345 {
0346 static const bool value = false;
0347 };
0348
0349 template<class T>
0350 struct is_lvalue_reference<T&>
0351 {
0352 static const bool value = true;
0353 };
0354
0355
0356
0357
0358 template<class T>
0359 struct is_array
0360 {
0361 static const bool value = false;
0362 };
0363
0364 template<class T>
0365 struct is_array<T[]>
0366 {
0367 static const bool value = true;
0368 };
0369
0370 template<class T, std::size_t N>
0371 struct is_array<T[N]>
0372 {
0373 static const bool value = true;
0374 };
0375
0376
0377
0378
0379 template <class T>
0380 struct has_pointer_type
0381 {
0382 struct two { char c[2]; };
0383 template <class U> static two test(...);
0384 template <class U> static char test(typename U::pointer* = 0);
0385 static const bool value = sizeof(test<T>(0)) == 1;
0386 };
0387
0388
0389
0390
0391 template <class T, class D, bool = has_pointer_type<D>::value>
0392 struct pointer_type_imp
0393 {
0394 typedef typename D::pointer type;
0395 };
0396
0397 template <class T, class D>
0398 struct pointer_type_imp<T, D, false>
0399 {
0400 typedef T* type;
0401 };
0402
0403 template <class T, class D>
0404 struct pointer_type
0405 {
0406 typedef typename pointer_type_imp
0407 <typename remove_extent<T>::type, typename remove_reference<D>::type>::type type;
0408 };
0409
0410
0411
0412
0413 #if defined(_MSC_VER) && (_MSC_VER >= 1400)
0414
0415
0416
0417 template <class T, class U>
0418 struct is_convertible
0419 {
0420 static const bool value = __is_convertible_to(T, U);
0421 };
0422
0423 #else
0424
0425 template <class T, class U>
0426 class is_convertible
0427 {
0428 typedef typename add_lvalue_reference<T>::type t_reference;
0429 typedef char true_t;
0430 class false_t { char dummy[2]; };
0431 static false_t dispatch(...);
0432 static true_t dispatch(U);
0433 static t_reference trigger();
0434 public:
0435 static const bool value = sizeof(dispatch(trigger())) == sizeof(true_t);
0436 };
0437
0438 #endif
0439
0440
0441
0442
0443 #if defined(BOOST_MSVC) || defined(__BORLANDC_)
0444 #define BOOST_MOVE_TT_DECL __cdecl
0445 #else
0446 #define BOOST_MOVE_TT_DECL
0447 #endif
0448
0449 #if defined(_MSC_EXTENSIONS) && !defined(__BORLAND__) && !defined(_WIN64) && !defined(_M_ARM) && !defined(_M_ARM64) && !defined(UNDER_CE)
0450 #define BOOST_MOVE_TT_TEST_MSC_FUNC_SIGS
0451 #endif
0452
0453 template <typename T>
0454 struct is_unary_function_impl
0455 { static const bool value = false; };
0456
0457
0458 #ifndef BOOST_MOVE_TT_TEST_MSC_FUNC_SIGS
0459
0460 template <typename R>
0461 struct is_unary_function_impl<R (*)()>
0462 { static const bool value = true; };
0463
0464 template <typename R>
0465 struct is_unary_function_impl<R (*)(...)>
0466 { static const bool value = true; };
0467
0468 #else
0469
0470 template <typename R>
0471 struct is_unary_function_impl<R (__stdcall*)()>
0472 { static const bool value = true; };
0473
0474 #ifndef _MANAGED
0475
0476 template <typename R>
0477 struct is_unary_function_impl<R (__fastcall*)()>
0478 { static const bool value = true; };
0479
0480 #endif
0481
0482 template <typename R>
0483 struct is_unary_function_impl<R (__cdecl*)()>
0484 { static const bool value = true; };
0485
0486 template <typename R>
0487 struct is_unary_function_impl<R (__cdecl*)(...)>
0488 { static const bool value = true; };
0489
0490 #endif
0491
0492
0493 #ifndef BOOST_MOVE_TT_TEST_MSC_FUNC_SIGS
0494
0495 template <typename R, class T0>
0496 struct is_unary_function_impl<R (*)(T0)>
0497 { static const bool value = true; };
0498
0499 template <typename R, class T0>
0500 struct is_unary_function_impl<R (*)(T0...)>
0501 { static const bool value = true; };
0502
0503 #else
0504
0505 template <typename R, class T0>
0506 struct is_unary_function_impl<R (__stdcall*)(T0)>
0507 { static const bool value = true; };
0508
0509 #ifndef _MANAGED
0510
0511 template <typename R, class T0>
0512 struct is_unary_function_impl<R (__fastcall*)(T0)>
0513 { static const bool value = true; };
0514
0515 #endif
0516
0517 template <typename R, class T0>
0518 struct is_unary_function_impl<R (__cdecl*)(T0)>
0519 { static const bool value = true; };
0520
0521 template <typename R, class T0>
0522 struct is_unary_function_impl<R (__cdecl*)(T0...)>
0523 { static const bool value = true; };
0524
0525 #endif
0526
0527 template <typename T>
0528 struct is_unary_function_impl<T&>
0529 { static const bool value = false; };
0530
0531 template<typename T>
0532 struct is_unary_function
0533 { static const bool value = is_unary_function_impl<T>::value; };
0534
0535
0536
0537
0538 #if (defined(BOOST_MSVC) && defined(BOOST_MSVC_FULL_VER) && (BOOST_MSVC_FULL_VER >=140050215))\
0539 || (defined(BOOST_INTEL) && defined(_MSC_VER) && (_MSC_VER >= 1500))
0540 # define BOOST_MOVEUP_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
0541 #elif defined(BOOST_CLANG) && defined(__has_feature)
0542 # if __has_feature(has_virtual_destructor)
0543 # define BOOST_MOVEUP_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
0544 # endif
0545 #elif defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) && !defined(__GCCXML__))) && !defined(BOOST_CLANG)
0546 # define BOOST_MOVEUP_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
0547 #elif defined(__ghs__) && (__GHS_VERSION_NUMBER >= 600)
0548 # define BOOST_MOVEUP_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
0549 #elif defined(BOOST_CODEGEARC)
0550 # define BOOST_MOVEUP_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
0551 #endif
0552
0553 #ifdef BOOST_MOVEUP_HAS_VIRTUAL_DESTRUCTOR
0554 template<class T>
0555 struct has_virtual_destructor{ static const bool value = BOOST_MOVEUP_HAS_VIRTUAL_DESTRUCTOR(T); };
0556 #else
0557
0558 template<class T>
0559 struct has_virtual_destructor{ static const bool value = true; };
0560 #endif
0561
0562 }
0563 }
0564
0565 #endif