1#ifndef MSTL_CORE_TYPEINFO_TYPE_TRAITS_HPP__
2#define MSTL_CORE_TYPEINFO_TYPE_TRAITS_HPP__
29template <
typename T, T Value>
31 static constexpr T
value = Value;
40 constexpr explicit operator value_type() const noexcept {
70template <u
int32_t Value>
78template <u
int64_t Value>
89template <
typename... Types>
101template <
bool Test,
typename T =
void>
115template <
bool Test,
typename T =
void>
126template <
bool Test,
typename T1,
typename T2>
132template <
typename T1,
typename T2>
142template <
bool Test,
typename T1,
typename T2>
156#ifdef MSTL_STANDARD_14__
172template <
typename T1,
typename T2>
180#ifdef MSTL_STANDARD_14__
185template <
typename T1,
typename T2>
216template <
typename T,
typename... Types>
219#ifdef MSTL_STANDARD_17__
220template <
typename T,
typename... Types>
223template <
typename T,
typename... Types>
227template <
typename T,
typename U>
230template <
typename T,
typename U,
typename... Types>
236#ifdef MSTL_STANDARD_14__
241template <
typename T,
typename... Types>
242MSTL_INLINE17
constexpr bool is_any_of_v =
is_any_of<T, Types...>::value;
250template <bool,
typename first,
typename...>
251struct __disjunction_aux {
254template <
typename Curr,
typename Next,
typename... Rest>
255struct __disjunction_aux<false, Curr, Next, Rest...> {
256 using type =
typename __disjunction_aux<static_cast<bool>(Next::value), Next, Rest...>::type;
268template <
typename... Args>
272template <
typename First,
typename... Rest>
274 :
_INNER __disjunction_aux<static_cast<bool>(First::value), First, Rest...>
::type {
278#ifdef MSTL_STANDARD_14__
283template <
typename... Args>
284MSTL_INLINE17
constexpr bool disjunction_v =
disjunction<Args...>::value;
291template <bool,
typename First,
typename...>
292struct __conjunction_aux {
295template <
typename Curr,
typename Next,
typename... Rest>
296struct __conjunction_aux<true, Curr, Next, Rest...> {
297 using type =
typename __conjunction_aux<static_cast<bool>(Next::value), Next, Rest...>::type;
309template <
typename... Args>
313template <
typename First,
typename... Rest>
315 :
_INNER __conjunction_aux<static_cast<bool>(First::value), First, Rest...>
::type {
319#ifdef MSTL_STANDARD_14__
324template <
typename... Args>
325MSTL_INLINE17
constexpr bool conjunction_v =
conjunction<Args...>::value;
401 template <
typename wrapper>
410 template <
typename wrapper>
418 template <
typename wrapper>
426 template <
typename wrapper>
427 using bind_cv_t =
const volatile wrapper;
444template <
typename From,
typename To>
463 template <
typename wrapper>
472 template <
typename wrapper>
480 template <
typename wrapper>
498template <
typename From,
typename To>
507template <
typename From,
typename To>
540template <
typename T,
size_t Idx>
570template <
typename T,
size_t Idx>
572 using type =
typename remove_all_extents<T>::type;
577 using type =
typename remove_all_extents<T>::type;
604 template <
typename wrapper>
613 template <
typename wrapper>
621 template <
typename wrapper>
629 template <
typename wrapper>
637 template <
typename wrapper>
655template <
typename From,
typename To>
671template <
typename Ret,
typename... Args>
673 using type = Ret(Args...);
676#define __MSTL_EXPAND_REM_FUNC_QULF(QUF) \
677template <typename Ret, typename... Args> \
678struct remove_function_qualifiers<Ret(Args...) QUF> { \
679 using type = Ret(Args...); \
682MSTL_MACRO_RANGES_CV(__MSTL_EXPAND_REM_FUNC_QULF)
683MSTL_MACRO_RANGES_CV_REF(__MSTL_EXPAND_REM_FUNC_QULF)
684MSTL_MACRO_RANGES_CV_REF_NOEXCEPT(__MSTL_EXPAND_REM_FUNC_QULF)
685#undef __MSTL_EXPAND_REM_FUNC_QULF
710struct __is_void_helper<void> :
true_type {};
724#ifdef MSTL_STANDARD_14__
740template <
typename T,
typename Dummy =
void>
760#ifdef MSTL_STANDARD_14__
775template <
typename T,
typename Dummy =
void>
802#ifdef MSTL_STANDARD_14__
819 char, signed char, unsigned char, wchar_t,
820#ifdef MSTL_STANDARD_20__
826#ifdef MSTL_STANDARD_14__
846#ifdef MSTL_STANDARD_20__
852#ifdef MSTL_STANDARD_14__
870#ifdef MSTL_STANDARD_14__
889 short, int, long, long long,
890 unsigned short, unsigned int, unsigned long, unsigned long long>::value> {};
892#ifdef MSTL_STANDARD_14__
912#ifdef MSTL_STANDARD_14__
930#ifdef MSTL_STANDARD_14__
949#ifdef MSTL_STANDARD_14__
961template <typename T, bool = is_integral<T>::value>
962struct __check_sign_aux {
968struct __check_sign_aux<T, false> {
970 static constexpr bool is_unsigned =
false;
983#ifdef MSTL_STANDARD_14__
1000#ifdef MSTL_STANDARD_14__
1005template <
typename T>
1022template <
typename T>
1024 using type =
const T;
1031template <
typename T>
1041template <
typename T>
1047template <
typename T>
1056template <
typename T>
1058 using type =
volatile T;
1065template <
typename T>
1073template <
typename T>
1075 using type =
const volatile T;
1082template <
typename T>
1094template <
typename T,
typename Dummy =
void>
1101template <
typename T>
1113template <
typename T>
1115 using type =
typename add_reference<T>::lvalue;
1122template <
typename T>
1130template <
typename T>
1132 using type =
typename add_reference<T>::rvalue;
1139template <
typename T>
1149template <
typename T,
typename Dummy =
void>
1155template <
typename T>
1165template <
typename T>
1182template <
typename T>
1191template <typename T>
1199template <typename T>
1217template <typename T>
1221template <
typename T,
size_t Idx>
1224template <
typename T>
1228#ifdef MSTL_STANDARD_14__
1233template <
typename T>
1246template <
typename T, u
int32_t Idx = 0>
1250template <
typename T,
size_t N>
1253template <
typename T, u
int32_t Idx,
size_t N>
1256template <
typename T, u
int32_t Idx>
1260#ifdef MSTL_STANDARD_14__
1265template <
typename T, u
int32_t Idx = 0>
1282template <
typename T>
1286template <
template <
typename,
typename...>
class T,
typename First,
typename... Rest>
1296template <
typename Tmp>
1305template <
typename... Types>
1309template <
typename First,
typename... Rest>
1319template <
typename... Types>
1331template <
typename T,
typename Dummy =
void>
1337template <
typename T>
1339 is_same<typename T::difference_type, typename T::difference_type>::value>> {
1340 using type =
typename T::difference_type;
1348template <
typename T>
1358template <
typename NewFirst,
typename T>
1362template <
typename NewFirst,
template <
typename,
typename...>
class T,
typename First,
typename... Rest>
1364 using type = T<NewFirst, Rest...>;
1372template <
typename T,
typename U>
1385template <
typename T,
typename U,
typename Dummy =
void>
1391template <
typename T,
typename U>
1393 is_same<typename T::template rebind<U>, typename T::template rebind<U>>::value>> {
1394 using type =
typename T::template rebind<U>;
1402template <
typename T,
typename U>
1418template <
typename T>
1422template <
typename T,
size_t Idx>
1426#ifdef MSTL_STANDARD_14__
1431template <
typename T>
1441template <
typename T>
1445template <
typename T>
1449#ifdef MSTL_STANDARD_14__
1454template <
typename T>
1465template <
typename T>
1468#ifdef MSTL_STANDARD_14__
1473template <
typename T>
1483template <
typename T>
1487template <
typename T>
1491#ifdef MSTL_STANDARD_14__
1496template <
typename T>
1505template <
typename T>
1509template <
typename T>
1513#ifdef MSTL_STANDARD_14__
1518template <
typename T>
1530template <
typename T>
1533#ifdef MSTL_STANDARD_14__
1538template <
typename T>
1548template <
typename T>
1551#ifdef MSTL_STANDARD_14__
1556template <
typename T>
1568template <
typename T>
1572template <
typename T>
1575template <
typename T>
1578template <
typename T>
1581template <
typename T>
1585#ifdef MSTL_STANDARD_14__
1590template <
typename T>
1600template <
typename T>
1603#ifdef MSTL_STANDARD_14__
1608template <
typename T>
1620template <
typename T>
1623#ifdef MSTL_STANDARD_14__
1628template <
typename T>
1638template <
typename T>
1641#ifdef MSTL_STANDARD_14__
1646template <
typename T>
1656template <
typename T>
1659#ifdef MSTL_STANDARD_14__
1664template <
typename T>
1676template <
typename T>
1678 disjunction<is_arithmetic<T>, is_void<T>, is_null_pointer<T>>::value> {};
1680#ifdef MSTL_STANDARD_14__
1685template <
typename T>
1697template <
typename T>
1700#ifdef MSTL_STANDARD_14__
1705template <
typename T>
1715template <
typename T>
1719template <
typename T>
1723#ifdef MSTL_STANDARD_14__
1728template <
typename T>
1738template <
typename T>
1742template <
typename T>
1746#ifdef MSTL_STANDARD_14__
1751template <
typename T>
1756#ifdef MSTL_COMPILER_MSVC__
1758#pragma warning(push)
1759#pragma warning(disable: 4180)
1770template <
typename T>
1772 !is_const<const remove_function_qualifiers_t<T>>::value
1773 && !is_reference<remove_function_qualifiers_t<T>>::value> {};
1775#ifdef MSTL_STANDARD_14__
1780template <
typename T>
1784#ifdef MSTL_COMPILER_MSVC__
1801template <
typename T>
1803 !(is_void<T>::value || is_reference<T>::value || is_function<T>::value || is_const<T>::value)
1804 && (sizeof(T) > 0)> {};
1806#ifdef MSTL_STANDARD_14__
1811template <
typename T>
1824template <
typename T>
1827#ifdef MSTL_STANDARD_14__
1832template <
typename T>
1846template <
typename T>
1848 (is_pointer<remove_cvref_t<T>>::value &&
1849 is_character<remove_pointer_t<remove_cvref_t<T>>>::value) ||
1850 (is_bounded_array<remove_cvref_t<T>>::value &&
1851 is_character<remove_all_extents_t<remove_cvref_t<T>>>::value)> {};
1853#ifdef MSTL_STANDARD_14__
1858template <
typename T>
1868template <
typename T>
1872#ifdef MSTL_COMPILER_CLANG__
1873template <
typename T>
1878struct __is_member_function_pointer_aux :
false_type {};
1879template <
typename T,
typename C>
1880struct __is_member_function_pointer_aux<T C::*> :
is_function<T> {};
1883template <
typename T>
1888#ifdef MSTL_STANDARD_14__
1893template <
typename T>
1903template <
typename T>
1907#ifdef MSTL_COMPILER_CLANG__
1908template <
typename T>
1911template <
typename T>
1913template <
typename T,
typename C>
1918#ifdef MSTL_STANDARD_14__
1923template <
typename T>
1933template <
typename T>
1937#ifdef MSTL_COMPILER_CLANG__
1938template <
typename T>
1941template <
typename T>
1946#ifdef MSTL_STANDARD_14__
1951template <
typename T>
1968template <
typename T>
1970 is_arithmetic<T>, is_enum<T>, is_pointer<T>, is_member_pointer<T>, is_null_pointer<T>
1973#ifdef MSTL_STANDARD_14__
1978template <
typename T>
1993template <
typename T>
1996#ifdef MSTL_STANDARD_14__
2001template <
typename T>
2013template <
typename T>
2016#ifdef MSTL_STANDARD_14__
2021template <
typename T>
2033template <
typename T>
2036#ifdef MSTL_STANDARD_14__
2041template <
typename T>
2053template <
typename T>
2056#ifdef MSTL_STANDARD_14__
2061template <
typename T>
2068template <typename T, bool = is_enum<T>::value>
2069struct __underlying_type_aux {
2070 using type = __underlying_type(T);
2072template <
typename T>
2073struct __underlying_type_aux<T, false> {};
2084template <
typename T>
2091template <
typename T>
2106template <
typename T>
2109#ifdef MSTL_STANDARD_14__
2114template <
typename T>
2126template <
typename T>
2129#ifdef MSTL_STANDARD_14__
2134template <
typename T>
2151template <
typename T>
2154#ifdef MSTL_STANDARD_14__
2159template <
typename T>
2176template <
typename T>
2180#ifdef MSTL_COMPILER_MSVC__
2181template <
typename T>
2184template <
typename T>
2189#ifdef MSTL_STANDARD_14__
2194template <
typename T>
2199#ifdef MSTL_COMPILER_MSVC__
2210template <
typename T1,
typename T2>
2211struct is_layout_compatible :
bool_constant<__is_layout_compatible(T1, T2)> {};
2217#ifdef MSTL_STANDARD_14__
2218template <
typename T1,
typename T2>
2219MSTL_INLINE17
constexpr bool is_layout_compatible_v = is_layout_compatible<T1, T2>::value;
2231template <
typename Base,
typename Derived>
2233 __is_pointer_interconvertible_base_of(Base, Derived)> {};
2235#ifdef MSTL_STANDARD_14__
2240template <
typename Base,
typename Derived>
2241MSTL_INLINE17
constexpr bool is_pointer_interconvertible_base_of_v = is_pointer_interconvertible_base_of<Base, Derived>::value;
2252template <
typename Base,
typename Derived>
2255#ifdef MSTL_STANDARD_14__
2260template <
typename Base,
typename Derived>
2265#ifdef MSTL_STANDARD_20__
2275template <
typename T,
typename Mem>
2276constexpr bool is_pointer_interconvertible_with_class(Mem T::*mp)
noexcept {
2277 return __builtin_is_pointer_interconvertible_with_class(mp);
2292template <
typename S1,
typename S2,
typename M1,
typename M2>
2293constexpr bool is_corresponding_member(M1 S1::* m1, M2 S2::* m2)
noexcept {
2294 return __builtin_is_corresponding_member(m1, m2);
2316template <
typename T>
2319#ifdef MSTL_STANDARD_14__
2324template <
typename T>
2336template <
typename T>
2339#ifdef MSTL_STANDARD_14__
2344template <
typename T>
2354template <
typename T>
2357#ifdef MSTL_STANDARD_14__
2362template <
typename T>
2373template <
typename T,
typename... Args>
2376#ifdef MSTL_STANDARD_14__
2381template <
typename T,
typename... Args>
2382MSTL_INLINE17
constexpr bool is_constructible_v =
is_constructible<T, Args...>::value;
2391template <
typename T>
2393 is_constructible<T, add_lvalue_reference_t<const T>>::value> {};
2395#ifdef MSTL_STANDARD_14__
2400template <
typename T>
2410template <
typename T>
2413#ifdef MSTL_STANDARD_14__
2418template <
typename T>
2425template <
typename T>
2426void __implicitly_default_construct_aux(
const T&)
noexcept;
2438template <
typename T,
typename Dummy =
void>
2442template <
typename T>
2447#ifdef MSTL_STANDARD_14__
2452template <
typename T>
2462template <
typename T>
2465#ifdef MSTL_STANDARD_14__
2470template <
typename T>
2481template <
typename To,
typename From>
2484#ifdef MSTL_STANDARD_14__
2489template <
typename To,
typename From>
2501template <
typename T>
2503 :
bool_constant<is_assignable<add_lvalue_reference_t<T>, add_lvalue_reference_t<const T>>::value> {};
2505#ifdef MSTL_STANDARD_14__
2510template <
typename T>
2522template <
typename T>
2525#ifdef MSTL_STANDARD_14__
2530template <
typename T>
2545template <
typename T>
2549#ifdef MSTL_COMPILER_MSVC__
2550template <
typename T>
2554template <
typename T>
2555struct __destructible_aux {
2557 template <typename T1, typename = decltype(declval<T1&>().~T1())>
2563 using type =
decltype(__test<T>(0));
2566template <
typename T,
2569struct __is_destructible_dispatch;
2571template <
typename T>
2572struct __is_destructible_dispatch<T, false, false>
2573 : __destructible_aux<remove_all_extents_t<T>>::type {};
2575template <
typename T>
2576struct __is_destructible_dispatch<T, true, false> :
false_type {};
2578template <
typename T>
2579struct __is_destructible_dispatch<T, false, true> :
true_type {};
2583template <
typename T>
2588#ifdef MSTL_STANDARD_14__
2593template <
typename T>
2606template <
typename T,
typename... Args>
2609#ifdef MSTL_STANDARD_14__
2614template <
typename T,
typename... Args>
2624template <
typename T>
2626 is_trivially_constructible<T, add_lvalue_reference_t<const T>>::value> {};
2628#ifdef MSTL_STANDARD_14__
2633template <
typename T>
2643template <
typename T>
2646#ifdef MSTL_STANDARD_14__
2651template <
typename T>
2661template <
typename T>
2664#ifdef MSTL_STANDARD_14__
2669template <
typename T>
2680template <
typename To,
typename From>
2683#ifdef MSTL_STANDARD_14__
2688template <
typename To,
typename From>
2698template <
typename T>
2700 is_trivially_assignable<add_lvalue_reference_t<T>, add_lvalue_reference_t<const T>>::value> {};
2702#ifdef MSTL_STANDARD_14__
2707template <
typename T>
2717template <
typename T>
2719 is_trivially_assignable<add_lvalue_reference_t<T>, T>::value> {};
2721#ifdef MSTL_STANDARD_14__
2726template <
typename T>
2738template <
typename T>
2740#if defined(MSTL_COMPILER_MSVC__) || defined(MSTL_COMPILER_CLANG__)
2746#ifdef MSTL_STANDARD_14__
2751template <
typename T>
2762template <
typename T,
typename... Args>
2770template <
typename T>
2774#ifdef MSTL_COMPILER_MSVC__
2775template <
typename T,
typename... Args>
2779template <typename T, bool = is_array<T>::value>
2780struct __is_nothrow_default_constructible_dispatch;
2782template <
typename T>
2783struct __is_nothrow_default_constructible_dispatch<T, true> :
conjunction<
2784 is_bounded_array<T>, bool_constant<noexcept(remove_all_extents_t<T>())>> {};
2786template <
typename T>
2787struct __is_nothrow_default_constructible_dispatch<T, false>
2792template <
typename T>
2794 is_default_constructible<T>, _INNER __is_nothrow_default_constructible_dispatch<T>> {};
2798template <
typename T,
typename... Args>
2799struct __is_nothrow_constructible_dispatch
2802template <
typename T>
2803struct __is_nothrow_constructible_dispatch<T>
2808template <
typename T,
typename... Args>
2810 is_constructible<T, Args...>, _INNER __is_nothrow_constructible_dispatch<T, Args...>> {};
2814#ifdef MSTL_STANDARD_14__
2819template <
typename T,
typename... Args>
2829template <
typename T>
2831 is_nothrow_constructible<T, add_lvalue_reference_t<const T>>::value> {};
2833#ifdef MSTL_STANDARD_14__
2838template <
typename T>
2844#ifdef MSTL_COMPILER_MSVC__
2845template <
typename T>
2851#ifdef MSTL_STANDARD_14__
2856template <
typename T>
2866template <
typename T>
2869#ifdef MSTL_STANDARD_14__
2874template <
typename T>
2885template <
typename To,
typename From>
2889template <
typename To,
typename From>
2891#ifdef MSTL_COMPILER_MSVC__
2899#ifdef MSTL_STANDARD_14__
2904template <
typename To,
typename From>
2914template <
typename T>
2916 is_nothrow_assignable<add_lvalue_reference_t<T>, add_lvalue_reference_t<const T>>::value> {};
2918#ifdef MSTL_STANDARD_14__
2923template <
typename T>
2933template <
typename T>
2935 is_nothrow_assignable<add_lvalue_reference_t<T>, T>::value> {};
2937#ifdef MSTL_STANDARD_14__
2942template <
typename T>
2947#ifndef MSTL_COMPILER_MSVC__
2950template <
typename T>
2951struct __is_nothrow_destructible_aux {
2953 template <
typename T1>
2960 using type =
decltype(__test<T>(0));
2963template <
typename T,
2966struct __is_nothrow_destructible_dispatch;
2968template <
typename T>
2969struct __is_nothrow_destructible_dispatch<T, false, false>
2970 : __is_nothrow_destructible_aux<remove_all_extents_t<T>>::type {};
2972template <
typename T>
2973struct __is_nothrow_destructible_dispatch<T, true, false> :
false_type {};
2975template <
typename T>
2976struct __is_nothrow_destructible_dispatch<T, false, true> :
true_type {};
2987template <
typename T>
2991template <
typename T>
2993#ifdef MSTL_COMPILER_MSVC__
2996 _INNER __is_nothrow_destructible_dispatch<T>::type {};
3000#ifdef MSTL_STANDARD_14__
3005template <
typename T>
3018template <
typename T>
3021#ifdef MSTL_STANDARD_14__
3026template <
typename T>
3046template <
typename T>
3048 return static_cast<T&&
>(x);
3060template <
typename T>
3063 return static_cast<T&&
>(x);
3074template <
typename T>
3087template <
typename T>
3088MSTL_NODISCARD
constexpr
3102template <
typename T>
3104 return __builtin_addressof(x);
3112template <
typename T>
3116#ifdef MSTL_STANDARD_17__
3123MSTL_NODISCARD
constexpr bool is_constant_evaluated() noexcept {
3124 return __builtin_is_constant_evaluated();
3136#if !defined(MSTL_COMPILER_MSVC__) && !defined(MSTL_COMPILER_CLANG__)
3139template <
typename From,
typename To,
bool = disjunction_v<is_
void<From>, is_function<To>, is_array<To>>>
3140struct __is_convertible_helper {
3141 using type =
typename is_void<To>::type;
3144template <
typename From,
typename To>
3145struct __is_convertible_helper<From, To, false> {
3147 template <typename From1, typename To1, typename = decltype(_MSTL declvoid<To1>(
_MSTL declval<From1>()))>
3150 template <
typename,
typename>
3154 using type =
decltype(__test<From, To>(0));
3166template <
typename From,
typename To>
3168#if defined(MSTL_COMPILER_MSVC__)
3170#elif defined(MSTL_COMPILER_CLANG__)
3173 __is_convertible_helper<From, To>::type {};
3176#ifdef MSTL_STANDARD_14__
3181template <
typename From,
typename To>
3185#if defined(MSTL_STANDARD_20__) || defined(MSTL_DOXYGEN_GENERATE)
3192template <
typename From,
typename To>
3205template <
typename ToElement,
typename FromElement>
3208#ifdef MSTL_STANDARD_14__
3213template <
typename ToElement,
typename FromElement>
3226template <
typename From,
typename To,
3232template <
typename From,
typename To,
bool IsVo
id>
3235template <
typename From,
typename To>
3239#ifdef MSTL_STANDARD_14__
3244template <
typename From,
typename To>
3256template <
typename Iterator,
typename Ptr,
bool IsPtr = is_po
inter<remove_cvref_t<Iterator>>::value>
3260template <
typename Iterator,
typename Ptr>
3262 noexcept(_MSTL declcopy<Ptr>(_MSTL declval<Iterator>().operator->()))> {};
3265#ifdef MSTL_STANDARD_14__
3270template <
typename Iterator,
typename Ptr>
3285struct __sign_byte_aux;
3288struct __sign_byte_aux<1> {
3290 using signed_t =
signed char;
3292 using unsigned_t =
unsigned char;
3295struct __sign_byte_aux<2> {
3297 using signed_t =
signed short;
3299 using unsigned_t =
unsigned short;
3302struct __sign_byte_aux<4> {
3303#ifdef MSTL_PLATFORM_WINDOWS__
3304 template <
typename T>
3308 template <
typename T>
3311#elif defined(MSTL_PLATFORM_LINUX__)
3313 using signed_t =
signed int;
3315 using unsigned_t =
unsigned int;
3319struct __sign_byte_aux<8> {
3320#ifdef MSTL_PLATFORM_WINDOWS__
3322 using signed_t =
signed long long;
3324 using unsigned_t =
unsigned long long;
3325#elif defined(MSTL_PLATFORM_LINUX__)
3326 template <
typename T>
3330 template <
typename T>
3336template <
typename T>
3337using __set_signed_byte =
typename __sign_byte_aux<
sizeof(T)>::template signed_t<T>;
3338template <
typename T>
3339using __set_unsigned_byte =
typename __sign_byte_aux<
sizeof(T)>::template unsigned_t<T>;
3341template <
typename T>
3344 "make signed only support non-bool && integral-like types");
3359template <
typename T>
3361 using type =
typename _INNER __set_sign<T>::signed_type;
3368template <
typename T>
3378template <
typename T>
3380 using type =
typename _INNER __set_sign<T>::unsigned_type;
3387template <
typename T>
3393template <
size_t Size,
bool IsSigned>
3394struct __make_integer_impl;
3396template <
size_t Size>
3397struct __make_integer_impl<Size, true> {
3398 using type =
typename __sign_byte_aux<Size>::template signed_t<int>;
3401template <
size_t Size>
3402struct __make_integer_impl<Size, false> {
3403 using type =
typename __sign_byte_aux<Size>::template unsigned_t<int>;
3414template <
size_t Size,
bool IsSigned = true>
3416 using type =
typename _INNER __make_integer_impl<Size, IsSigned>::type;
3423template <
size_t Size,
bool IsSigned = true>
3432template <
size_t... Values>
3436template <
size_t Value>
3439template <
size_t First,
size_t Second,
size_t... Rest>
3440struct max_value<First, Second, Rest...> :
max_value<(First > Second ? First : Second), Rest...> {};
3443#ifdef MSTL_STANDARD_14__
3444template <
size_t... Values>
3445MSTL_INLINE17
constexpr size_t max_value_v =
max_value<Values...>::value;
3461template <
typename T>
3464#ifdef MSTL_STANDARD_14__
3469template <
typename T>
3480template <
size_t Len,
size_t Align = alignof(_MSTL max_align_t)>
3482 static_assert((Align & (Align - 1)) == 0,
"Alignment must be power of two");
3497template <
size_t Len,
size_t Align = alignof(_MSTL max_align_t)>
3509template <
size_t Len,
typename... Types>
3512 static constexpr size_t required_alignment =
max_value<
alignof(Types)...>::value;
3513 static constexpr size_t required_size =
max_value<
sizeof(Types)...>::value;
3514 static constexpr size_t storage_size = (Len > required_size) ? Len : required_size;
3516 static_assert((required_alignment & (required_alignment - 1)) == 0,
"Alignment must be power of two");
3532 struct alignas(alignment_value)
type {
3546 template <
typename T>
3549 sizeof(T) <= storage_size &&
3558template <
size_t Len,
typename... Types>
3561#ifdef MSTL_STANDARD_14__
3566template <
size_t Len,
typename... Types>
3567constexpr size_t aligned_union_v =
aligned_union<Len, Types...>::align_value;
3588template <
typename T>
3602template <
typename T>
3608template <
typename Default,
typename,
template <
typename...>
class,
typename...>
3611 using type = Default;
3613template <
typename Default,
template <
typename...>
class Op,
typename... Args>
3614struct __detector<Default,
void_t<Op<Args...>>, Op, Args...> {
3616 using type = Op<Args...>;
3628template <
typename Default,
template <
typename...>
class Op,
typename... Args>
3635template <
typename Default,
template <
typename...>
class Op,
typename... Args>
3650template <
typename T1,
typename T2>
3656template <
typename,
typename,
typename =
void>
3657struct __oper_decay_aux {};
3658template <
typename T1,
typename T2>
3670template <
typename... Types>
3677template <
typename... Types>
3684template <
typename T1>
3685struct common_type<T1> : common_type<T1, T1> {};
3687template <
typename T1,
typename T2>
3688struct common_type<T1, T2> :
_INNER __oper_decay_aux<T1, T2> {};
3690template <
typename T1,
typename T2,
typename... Rest>
3691struct common_type<T1, T2, Rest...> : common_type<common_type_t<T1, T2>, Rest...> {};
3695#ifdef MSTL_STANDARD_20__
3702template <
typename... Types>
3703struct common_reference;
3709template <
typename... Types>
3710using common_reference_t =
typename common_reference<Types...>::type;
3715struct common_reference<> {};
3717template <
typename T>
3718struct common_reference<T> {
3725template <
typename T1,
typename T2>
3726struct __common_reference_base_aux : common_type<T1, T2> {};
3728template <
typename T1,
typename T2>
requires requires {
3731struct __common_reference_base_aux<T1, T2> {
3735template <
typename,
typename,
template <
typename>
typename,
template <
typename>
typename>
3736struct __basic_common_reference {};
3738template <
typename T1>
3739struct __add_qualifier_aux {
3740 template <
typename T2>
3744template <
typename T1,
typename T2>
3745using qualifier_extract =
typename __basic_common_reference<remove_cvref_t<T1>,
remove_cvref_t<T2>,
3746 __add_qualifier_aux<T1>::template apply_t, __add_qualifier_aux<T2>::template apply_t>::type;
3748template <
typename T1,
typename T2>
3749struct __common_ref_qualify_aux : __common_reference_base_aux<T1, T2> {};
3751template <
typename T1,
typename T2>
3752 requires requires {
typename qualifier_extract<T1, T2>; }
3753struct __common_ref_qualify_aux<T1, T2> {
3754 using type = qualifier_extract<T1, T2>;
3757template <
typename T1,
typename T2>
3758struct __common_reference_ptr_aux : __common_ref_qualify_aux<T1, T2> {};
3760template <
typename T1,
typename T2>
requires
3761 is_lvalue_reference_v<common_ternary_operator_t<copy_cv_t<T1, T2>&,
copy_cv_t<T2, T1>&>>
3764template <
typename,
typename>
3765struct __common_reference_aux {};
3767template <
typename T1,
typename T2>
3768 requires requires {
typename __common_lvalue_aux<T1, T2>; }
3769struct __common_reference_aux<T1&, T2&> {
3770 using type = __common_lvalue_aux<T1, T2>;
3773template <
typename T1,
typename T2>
requires
3774 is_convertible_v<T1&&, __common_lvalue_aux<const T1, T2>>
3775struct __common_reference_aux<T1&&, T2&> {
3776 using type = __common_lvalue_aux<const T1, T2>;
3779template <
typename T1,
typename T2>
requires
3780 is_convertible_v<T2&&, __common_lvalue_aux<const T2, T1>>
3781struct __common_reference_aux<T1&, T2&&> {
3782 using type = __common_lvalue_aux<const T2, T1>;
3785template <
typename T1,
typename T2>
3788template <
typename T1,
typename T2>
requires
3789 is_convertible_v<T1&&, __common_rvalue_aux<T1, T2>> &&
3790 is_convertible_v<T2&&, __common_rvalue_aux<T1, T2>>
3791struct __common_reference_aux<T1&&, T2&&> {
3792 using type = __common_rvalue_aux<T1, T2>;
3795template <
typename T1,
typename T2>
3796using __common_reference_aux_t =
typename __common_reference_aux<T1, T2>::type;
3798template <
typename T1,
typename T2>
requires
3801struct __common_reference_ptr_aux<T1, T2> {
3802 using type = __common_reference_aux_t<T1, T2>;
3808template <
typename T1,
typename T2>
3809struct common_reference<T1, T2> :
_INNER __common_reference_ptr_aux<T1, T2> {};
3811template <
typename T1,
typename T2,
typename T3,
typename... Rest>
3812struct common_reference<T1, T2, T3, Rest...> {};
3814template <
typename T1,
typename T2,
typename T3,
typename... Rest>
3815 requires requires {
typename common_reference_t<T1, T2>; }
3816struct common_reference<T1, T2, T3, Rest...> : common_reference<common_reference_t<T1, T2>, T3, Rest...> {};
3830template <
typename T,
template <
typename...>
class Template>
3834template <
template <
typename...>
class Template,
typename... Args>
3838#ifdef MSTL_STANDARD_17__
3843template <
typename T,
template <
typename...>
class Template>
3852template <
typename T,
template <
typename...>
class Template>
3870struct is_nothrow_swappable;
3879template <
typename T>
3891template <
typename T,
size_t Size>
3892MSTL_CONSTEXPR14 enable_if_t<is_swappable<T>::value>
3893swap(T(& lhs)[Size], T(& rhs)[Size])
3909template <
typename T,
typename U = T>
3910MSTL_CONSTEXPR14 T
exchange(T& val, U&& new_val)
3921template <
typename T1,
typename T2,
typename Dummy =
void>
3925template <
typename T1,
typename T2>
3939template <
typename T1,
typename T2>
3941 conjunction<is_swappable_from<T1, T2>, is_swappable_from<T2, T1>>::value> {};
3949template <
typename T>
3951 is_swappable_with<add_lvalue_reference_t<T>, add_lvalue_reference_t<T>>::value> {};
3953#ifdef MSTL_STANDARD_14__
3958template <
typename T>
3969template <
typename T1,
typename T2>
3971 noexcept(_MSTL swap(_MSTL declval<T1>(), _MSTL declval<T2>())) &&
3972 noexcept(_MSTL swap(_MSTL declval<T2>(), _MSTL declval<T1>()))> {};
3981template <
typename T1,
typename T2>
3983 conjunction<is_swappable_with<T1, T2>, is_nothrow_swappable_from<T1, T2>>::value> {};
3991template <
typename T>
3993 is_nothrow_swappable_with<add_lvalue_reference_t<T>, add_lvalue_reference_t<T>>::value> {};
3995#ifdef MSTL_STANDARD_14__
4000template <
typename T>
4015template <
typename T,
typename Dummy =
void>
4019template <
typename T>
4036template <
typename T>
4038 is_trivially_destructible<T>, is_trivially_move_constructible<T>,
4039 is_trivially_move_assignable<T>, negation<is_ADL_swappable<T>>>::value> {};
4041#ifdef MSTL_STANDARD_14__
4046template <
typename T>
4051template <
typename T>
4061template <
typename T,
size_t Size>
4062MSTL_CONSTEXPR14 enable_if_t<is_swappable<T>::value>
4063swap(T(& lhs)[Size], T(& rhs)[Size])
4065 if (&lhs == &rhs)
return;
4067 T* last1 = first1 + Size;
4069 for (; first1 != last1; ++first1, ++first2) {
4075template <
typename T,
typename U>
4091#ifdef MSTL_STANDARD_20__
4101template <
typename T>
4102concept is_pair_v =
requires(T p) {
4103 typename T::first_type;
4104 typename T::second_type;
4121template <
typename Alloc,
typename Dummy =
void>
4125template <
typename Alloc>
4127 typename Alloc::value_type, decltype(declval<Alloc&>().allocate(size_t{}))>>
4131#ifdef MSTL_STANDARD_14__
4136template <
typename Alloc>
4143template <
typename T>
4144struct __has_valid_begin_end {
4146 template <
typename U>
4147 static auto __test(
int) ->
decltype(
4149 is_same<decltype(declval<U>().begin()),
decltype(
declval<U>().
end())>(),
4153 template <
typename U>
4157 static constexpr bool value =
decltype(__test<T>(0))::value;
4168template <
typename Iterator>
4171 template <
typename U>
4172 static auto __test(
int) ->
decltype(
4177 template <
typename U>
4181 static constexpr bool value =
decltype(__test<Iterator>(0))::value;
4184#ifdef MSTL_STANDARD_14__
4189template <
typename Iterator>
4190MSTL_INLINE17
constexpr bool is_incrementible_v = is_incrementible<Iterator>::value;
4199template <
typename Iterator>
4202 template <
typename U>
4203 static auto __test(
int) ->
decltype(
4208 template <
typename U>
4211 static constexpr bool value =
decltype(__test<Iterator>(0))::value;
4214#ifdef MSTL_STANDARD_14__
4219template <
typename Iterator>
4220MSTL_INLINE17
constexpr bool is_decrementible_v = is_decrementible<Iterator>::value;
4233template <
typename Container>
4235 _INNER __has_valid_begin_end<Container>::value &&
4236 is_incrementible<decltype(declval<Container>().begin())>::value
4239#ifdef MSTL_STANDARD_14__
4244template <
typename T>
4251template <
typename T>
4252struct __has_first_and_second {
4254 template <
typename U>
4255 static auto __test(
int) ->
decltype(
4260 template <
typename U>
4264 static constexpr bool value =
decltype(__test<T>(0))::value;
4278template <
typename Map>
4280 is_iterable<Map>::value &&
4281 _INNER __has_first_and_second<decltype(*declval<decltype(declval<Map>().begin())>())>::value
4284#ifdef MSTL_STANDARD_14__
4289template <
typename Map>
4296template <
typename Alloc,
typename T,
typename... Args>
4297struct __has_construct_impl {
4299 template <
typename Alloc1,
4307 using type =
decltype(__test<Alloc>(0));
4319template <
typename Alloc,
typename T,
typename... Args>
4322#ifdef MSTL_STANDARD_14__
4327template <
typename Alloc,
typename T,
typename... Args>
4328MSTL_INLINE17
constexpr bool has_construct_v =
has_construct<Alloc, T, Args...>::value;
4334template <
typename T>
4335struct __has_base_impl {
4337 template <
typename U>
4340 template <
typename U>
4343 static constexpr bool value =
decltype(__test<T>(0))::value;
4353template <
typename T>
4356#ifdef MSTL_STANDARD_14__
4361template <
typename T>
4383template <typename T, enable_if_t<is_default_constructible<T>::value,
int> = 0>
4388#define INITIALIZE_BASIC_FUNCTION__(OPT) \
4389template <> constexpr OPT initialize() noexcept { return static_cast<OPT>(0); }
4390MSTL_MACRO_RANGE_CHARS(INITIALIZE_BASIC_FUNCTION__)
4391MSTL_MACRO_RANGE_FLOAT(INITIALIZE_BASIC_FUNCTION__)
4392MSTL_MACRO_RANGE_INT(INITIALIZE_BASIC_FUNCTION__)
4394#undef INITIALIZE_BASIC_FUNCTION__
typename add_volatile< T >::type add_volatile_t
add_volatile的便捷别名
MSTL_NODISCARD constexpr add_const_t< T > & as_const(T &val) noexcept
将值转换为const引用
typename add_pointer< T >::type add_pointer_t
add_pointer的便捷别名
typename add_const< T >::type add_const_t
add_const的便捷别名
typename add_cv< T >::type add_cv_t
add_cv的类型别名
typename add_reference< T >::lvalue add_lvalue_reference_t
add_lvalue_reference的便捷别名
typename add_reference< T >::rvalue add_rvalue_reference_t
add_rvalue_reference的便捷别名
typename aligned_union< Len, Types... >::type aligned_union_t
aligned_union的便捷别名
typename aligned_storage< Len, Align >::type aligned_storage_t
aligned_storage的便捷别名
MSTL_NODISCARD constexpr remove_reference_t< T > && move(T &&x) noexcept
无条件转换为右值引用
MSTL_NODISCARD constexpr T * addressof(T &x) noexcept
获取对象的地址
MSTL_NODISCARD constexpr T && forward(remove_reference_t< T > &x) noexcept
完美转发左值
MSTL_NODISCARD constexpr conditional_t<!is_nothrow_move_constructible< T >::value &&is_copy_constructible< T >::value, const T &, T && > move_if_noexcept(T &x) noexcept
在安全的情况下执行移动操作
typename unpackage< T >::type unpackage_t
unpackage的便捷别名
unpackage_t< remove_cvref_t< T > > unpack_remove_cvref_t
同时解包并移除cv和引用限定符
typename package< T >::type package_t
package的便捷别名
typename underlying_type< T >::type underlying_type_t
underlying_type的便捷别名
is_convertible< FromElement(*)[], ToElement(*)[]> is_array_convertible
判断数组元素类型FromElement是否可以转换为ToElement
unsigned char byte_t
字节类型,定义为无符号字符
#define _MSTL
全局命名空间MSTL前缀
#define MSTL_END_INNER__
结束inner命名空间
#define _INNER
inner命名空间前缀
#define MSTL_END_NAMESPACE__
结束全局命名空间MSTL
#define MSTL_BEGIN_NAMESPACE__
开始全局命名空间MSTL
#define MSTL_BEGIN_INNER__
开始inner命名空间
typename remove_all_extents< T >::type remove_all_extents_t
remove_all_extents的便捷别名
copy_ref_t< From, copy_cv_t< From, To > > copy_cvref_t
同时复制cv和引用限定符
typename remove_pointer< From >::template bind_pointer_t< To > copy_pointer_t
复制指针限定符
typename remove_function_qualifiers< T >::type remove_function_qualifiers_t
remove_function_qualifiers的便捷别名
typename remove_cvref< T >::type remove_cvref_t
remove_cvref的便捷别名
typename remove_cv< From >::template bind_cv_t< To > copy_cv_t
复制cv限定符
typename remove_volatile< T >::type remove_volatile_t
remove_volatile的便捷别名
typename remove_reference< T >::type remove_reference_t
remove_reference的便捷别名
typename remove_const< T >::type remove_const_t
remove_const的便捷别名
typename remove_pointer< T >::type remove_pointer_t
remove_pointer的便捷别名
typename remove_cv< T >::type remove_cv_t
remove_cv的便捷别名
typename remove_reference< From >::template bind_ref_t< To > copy_ref_t
复制引用限定符
typename remove_extent< T >::type remove_extent_t
remove_extent的便捷别名
constexpr Iterator2 move(Iterator1 first, Iterator1 last, Iterator2 result)
移动范围元素
typename make_integer< Size, IsSigned >::type make_integer_t
make_integer的便捷别名
typename make_unsigned< T >::type make_unsigned_t
make_unsigned的便捷别名
typename make_signed< T >::type make_signed_t
make_signed的便捷别名
void swap()=delete
删除无参数的swap重载
MSTL_CONSTEXPR14 T exchange(T &val, U &&new_val) noexcept(conjunction< is_nothrow_move_constructible< T >, is_nothrow_assignable< T &, U > >::value)
将新值赋给对象并返回旧值
typename get_first_para< Types... >::type get_first_para_t
get_first_para的便捷别名
typename get_ptr_difference< T >::type get_ptr_difference_t
get_ptr_difference的便捷别名
typename replace_first_para< T, U >::type replace_first_para_t
replace_first_para的便捷别名
typename get_first_temp_para< Tmp >::type get_first_temp_para_t
get_first_temp_para的便捷别名
typename get_rebind_type< T, U >::type get_rebind_type_t
get_rebind_type的便捷别名
typename common_type< Types... >::type common_type_t
common_type的便捷别名
typename decay< T >::type decay_t
decay的便捷别名
typename detected_or< Default, Op, Args... >::type detected_or_t
detected_or的便捷别名,返回检测到的类型或默认类型
constexpr bool is_specialization_v()
is_specialization的便捷函数模板
_INNER __detector< Default, void, Op, Args... > detected_or
检测Op<Args...>是否有效,如果无效则使用Default类型
decltype(true ? _MSTL declval< T1 >() :_MSTL declval< T2 >()) common_ternary_operator_t
三目运算符的公共类型推导
MSTL_NODISCARD MSTL_ALWAYS_INLINE constexpr decltype(auto) end(Container &cont) noexcept(noexcept(cont.end()))
获取容器的结束迭代器
constexpr T initialize() noexcept(is_nothrow_default_constructible< T >::value)
返回类型T的默认初始化值
integral_constant< uint64_t, Value > uint64_constant
64位无符号整数常量包装器
typename conditional< Test, T1, T2 >::type conditional_t
conditional的便捷别名
integral_constant< uint32_t, Value > uint32_constant
32位无符号整数常量包装器
bool_constant< true > true_type
表示true的类型
typename type_identity< T >::type type_identity_t
type_identity的便捷别名
bool_constant< false > false_type
表示false的类型
integral_constant< bool, Value > bool_constant
布尔常量包装器
typename enable_if< Test, T >::type enable_if_t
enable_if的便捷别名
byte_t data[storage_size]
原始存储数据
static constexpr bool is_storable() noexcept
检查指定类型是否可以安全存储在aligned_union中
static constexpr size_t size_value
存储的实际大小
static constexpr size_t alignment_value
存储的对齐要求
integral_constant< T, Value > type
自身类型
static constexpr bool value
MSTL_NODISCARD constexpr value_type operator()() const noexcept
函数调用运算符,用于获取值
wrapper bind_cv_t
将原类型的cv限定符应用到其他类型
wrapper bind_pointer_t
将原类型的指针限定符应用到其他类型
wrapper bind_ref_t
将原类型的引用限定符应用到其他类型