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