[+] AuIsPair_v

[+] AuVoid_t
This commit is contained in:
Reece Wilson 2023-03-23 02:03:10 +00:00
parent ce59f4c437
commit 58ffac4672
2 changed files with 39 additions and 6 deletions

View File

@ -300,6 +300,9 @@ struct AuRemoveExtent<T[Len]>
template <class T>
using AuRemoveExtent_t = typename AuRemoveExtent<T>::type;
template <class ... Ts>
using AuVoid_t = void;
template <class>
constexpr inline bool AuIsArray_v = false;

View File

@ -36,6 +36,42 @@
#define AURORA_RUNTIME_APPLY std::apply
#endif
template<typename T, typename U = void>
struct IsPairImpl : AuFalseType
{ };
template<typename T>
struct IsPairImpl <T, AuVoid_t<typename T::first_type,
typename T::second_type,
decltype(&T::first),
decltype(&T::second)>> : AuTrueType
{
};
template <class T, class Enable = void>
struct AuIsPair_C;
template <class T>
struct AuIsPair_C<T, typename AuEnableIf_t<IsPairImpl<T>::value>>
{
using type = typename AuPair<typename T::first_type, typename T::second_type>;
};
template <class T>
struct AuIsPair_C<T, typename AuEnableIf_t<!IsPairImpl<T>::value>>
{
using type = void;
};
template <class T>
constexpr inline bool AuIsPair_v = AuIsSame_v<typename AuIsPair_C<AuRemoveCV_t<T>>::type, AuRemoveCV_t<T>>;
template <class... Args>
static auto AuMakePair(Args&&... args)
{
return AURORA_RUNTIME_MAKE_PAIR(AuForward<Args>(args)...);
}
template<typename T>
struct AuIsTuple : AuFalseType
{ };
@ -47,12 +83,6 @@ struct AuIsTuple<AuTuple<Ts...>> : AuTrueType
template <class T>
inline constexpr bool AuIsTuple_v = AuIsTuple<T>::type::value;
template <class... Args>
static auto AuMakePair(Args&&... args)
{
return AURORA_RUNTIME_MAKE_PAIR(AuForward<Args>(args)...);
}
template <class... Args>
static auto AuMakeTuple(Args&&... args)
{