/* * Copyright (c) 2018-2021, Andreas Kling * Copyright (c) 2021, Ali Mohammad Pur * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once namespace AK::Detail { template struct EnableIf { }; template struct EnableIf { using Type = T; }; template struct IntegralConstant { static constexpr T value = v; using ValueType = T; using Type = IntegralConstant; constexpr operator ValueType() const { return value; } constexpr ValueType operator()() const { return value; } }; using FalseType = IntegralConstant; using TrueType = IntegralConstant; template using AddConst = const T; template struct __RemoveConst { using Type = T; }; template struct __RemoveConst { using Type = T; }; template using RemoveConst = typename __RemoveConst::Type; template struct __RemoveVolatile { using Type = T; }; template struct __RemoveVolatile { using Type = T; }; template using RemoveVolatile = typename __RemoveVolatile::Type; template using RemoveCV = RemoveVolatile>; template using VoidType = void; template inline constexpr bool IsLvalueReference = false; template inline constexpr bool IsLvalueReference = true; template inline constexpr bool __IsPointerHelper = false; template inline constexpr bool __IsPointerHelper = true; template inline constexpr bool IsPointer = __IsPointerHelper>; template inline constexpr bool IsFunction = false; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsFunction = true; template inline constexpr bool IsRvalueReference = false; template inline constexpr bool IsRvalueReference = true; template struct __RemovePointer { using Type = T; }; template struct __RemovePointer { using Type = T; }; template struct __RemovePointer { using Type = T; }; template struct __RemovePointer { using Type = T; }; template struct __RemovePointer { using Type = T; }; template using RemovePointer = typename __RemovePointer::Type; template inline constexpr bool IsSame = false; template inline constexpr bool IsSame = true; template struct __Conditional { using Type = TrueType; }; template struct __Conditional { using Type = FalseType; }; template using Conditional = typename __Conditional::Type; template inline constexpr bool IsNullPointer = IsSame>; template struct __RemoveReference { using Type = T; }; template struct __RemoveReference { using Type = T; }; template struct __RemoveReference { using Type = T; }; template using RemoveReference = typename __RemoveReference::Type; template struct __MakeUnsigned { using Type = void; }; template<> struct __MakeUnsigned { using Type = unsigned char; }; template<> struct __MakeUnsigned { using Type = unsigned short; }; template<> struct __MakeUnsigned { using Type = unsigned int; }; template<> struct __MakeUnsigned { using Type = unsigned long; }; template<> struct __MakeUnsigned { using Type = unsigned long long; }; template<> struct __MakeUnsigned { using Type = unsigned char; }; template<> struct __MakeUnsigned { using Type = unsigned short; }; template<> struct __MakeUnsigned { using Type = unsigned int; }; template<> struct __MakeUnsigned { using Type = unsigned long; }; template<> struct __MakeUnsigned { using Type = unsigned long long; }; template<> struct __MakeUnsigned { using Type = unsigned char; }; template<> struct __MakeUnsigned { using Type = char8_t; }; template<> struct __MakeUnsigned { using Type = char16_t; }; template<> struct __MakeUnsigned { using Type = char32_t; }; template<> struct __MakeUnsigned { using Type = bool; }; template using MakeUnsigned = typename __MakeUnsigned::Type; template struct __MakeSigned { }; template<> struct __MakeSigned { using Type = signed char; }; template<> struct __MakeSigned { using Type = short; }; template<> struct __MakeSigned { using Type = int; }; template<> struct __MakeSigned { using Type = long; }; template<> struct __MakeSigned { using Type = long long; }; template<> struct __MakeSigned { using Type = char; }; template<> struct __MakeSigned { using Type = short; }; template<> struct __MakeSigned { using Type = int; }; template<> struct __MakeSigned { using Type = long; }; template<> struct __MakeSigned { using Type = long long; }; template<> struct __MakeSigned { using Type = char; }; template using MakeSigned = typename __MakeSigned::Type; template inline constexpr bool IsVoid = IsSame>; template inline constexpr bool IsConst = false; template inline constexpr bool IsConst = true; template inline constexpr bool IsEnum = __is_enum(T); template inline constexpr bool IsUnion = __is_union(T); template inline constexpr bool IsClass = __is_class(T); template inline constexpr bool IsBaseOf = __is_base_of(Base, Derived); template inline constexpr bool __IsIntegral = false; template<> inline constexpr bool __IsIntegral = true; template<> inline constexpr bool __IsIntegral = true; template<> inline constexpr bool __IsIntegral = true; template<> inline constexpr bool __IsIntegral = true; template<> inline constexpr bool __IsIntegral = true; template<> inline constexpr bool __IsIntegral = true; template<> inline constexpr bool __IsIntegral = true; template<> inline constexpr bool __IsIntegral = true; template<> inline constexpr bool __IsIntegral = true; template inline constexpr bool IsIntegral = __IsIntegral>>; template inline constexpr bool __IsFloatingPoint = false; template<> inline constexpr bool __IsFloatingPoint = true; template<> inline constexpr bool __IsFloatingPoint = true; template<> inline constexpr bool __IsFloatingPoint = true; template inline constexpr bool IsFloatingPoint = __IsFloatingPoint>; template using CopyConst = Conditional, AddConst, RemoveConst>; template using Void = void; template constexpr auto DependentFalse = false; template inline constexpr bool IsSigned = IsSame>; template inline constexpr bool IsUnsigned = IsSame>; template inline constexpr bool IsArithmetic = IsIntegral || IsFloatingPoint; template inline constexpr bool IsFundamental = IsArithmetic || IsVoid || IsNullPointer; template struct IntegerSequence { using Type = T; static constexpr unsigned size() noexcept { return sizeof...(Ts); }; }; template using IndexSequence = IntegerSequence; template auto make_integer_sequence_impl() { if constexpr (N == 0) return IntegerSequence {}; else return make_integer_sequence_impl(); } template using MakeIntegerSequence = decltype(make_integer_sequence_impl()); template using MakeIndexSequence = MakeIntegerSequence; template struct __IdentityType { using Type = T; }; template using IdentityType = typename __IdentityType::Type; template requires(IsEnum) using UnderlyingType = __underlying_type(T); template inline constexpr bool IsTrivial = __is_trivial(T); template inline constexpr bool IsTriviallyCopyable = __is_trivially_copyable(T); } using AK::Detail::AddConst; using AK::Detail::Conditional; using AK::Detail::CopyConst; using AK::Detail::DependentFalse; using AK::Detail::EnableIf; using AK::Detail::FalseType; using AK::Detail::IdentityType; using AK::Detail::IndexSequence; using AK::Detail::IntegerSequence; using AK::Detail::IsArithmetic; using AK::Detail::IsBaseOf; using AK::Detail::IsClass; using AK::Detail::IsConst; using AK::Detail::IsEnum; using AK::Detail::IsFloatingPoint; using AK::Detail::IsFunction; using AK::Detail::IsFundamental; using AK::Detail::IsIntegral; using AK::Detail::IsLvalueReference; using AK::Detail::IsNullPointer; using AK::Detail::IsPointer; using AK::Detail::IsRvalueReference; using AK::Detail::IsSame; using AK::Detail::IsSigned; using AK::Detail::IsTrivial; using AK::Detail::IsTriviallyCopyable; using AK::Detail::IsUnion; using AK::Detail::IsUnsigned; using AK::Detail::IsVoid; using AK::Detail::MakeIndexSequence; using AK::Detail::MakeIntegerSequence; using AK::Detail::MakeSigned; using AK::Detail::MakeUnsigned; using AK::Detail::RemoveConst; using AK::Detail::RemoveCV; using AK::Detail::RemovePointer; using AK::Detail::RemoveReference; using AK::Detail::RemoveVolatile; using AK::Detail::TrueType; using AK::Detail::UnderlyingType; using AK::Detail::Void;