182 lines
6.3 KiB
C++
182 lines
6.3 KiB
C++
/***
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: auROXTLTypes.hpp
|
|
Date: 2022-2-2
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
#if !defined(AURORA_RUNTINE_TYPEDEFS_INCLUDE)
|
|
#include <vector>
|
|
#include <utility>
|
|
#include <map>
|
|
#include <list>
|
|
#include <string>
|
|
#include <array>
|
|
#include <algorithm>
|
|
#include <unordered_map>
|
|
#include <memory>
|
|
#include <optional>
|
|
#include <functional>
|
|
|
|
#else
|
|
#if defined(AURORA_RUNTINE_TYPEDEFS_INCLUDE_HEADER)
|
|
#include <AURORA_RUNTINE_TYPEDEFS_INCLUDE_HEADER>
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
#include <auROXTL/auTypes.hpp>
|
|
#include <auROXTL/auTryConstruct.hpp>
|
|
#include <auROXTL/auTryCall.hpp>
|
|
#include <auROXTL/auTemplateMeta.hpp>
|
|
|
|
// TODO: move to header
|
|
// this needs to be after template mater and before containers and optional
|
|
namespace __audetail
|
|
{
|
|
#define _AUROXTL_DETAIAL_HAS(name) \
|
|
template <class T> \
|
|
struct AuHas ## name \
|
|
{ \
|
|
template <class C> static constexpr AuTrueType Test(decltype(&C::name)); \
|
|
template <class C> static constexpr AuFalseType Test(...); \
|
|
using type = decltype(Test<T>(0)); \
|
|
}; \
|
|
\
|
|
template <class T> \
|
|
constexpr inline bool AuHas ## name ## _v = AuHas ## name<T>::type::value;
|
|
_AUROXTL_DETAIAL_HAS(has_value);
|
|
_AUROXTL_DETAIAL_HAS(capacity)
|
|
_AUROXTL_DETAIAL_HAS(reserve)
|
|
|
|
template <class T>
|
|
constexpr inline bool AuIsPreallocatable_v = AuHascapacity_v<T> && AuHasreserve_v<T>;
|
|
|
|
template <class T>
|
|
struct AuHastry_emplace
|
|
{
|
|
template <class C> static constexpr AuTrueType Test(decltype(&C::try_emplace));
|
|
template <class C> static constexpr AuFalseType Test(...);
|
|
using type = decltype(Test<T>(0));
|
|
};
|
|
|
|
template <class T>
|
|
constexpr inline bool AuHastry_emplace_v = false;// <T>::type::value;
|
|
|
|
template <class T>
|
|
struct AuHasemplace
|
|
{
|
|
template <class C> static constexpr AuTrueType Test(decltype(&C::emplace));
|
|
template <class C> static constexpr AuFalseType Test(...);
|
|
using type = decltype(Test<T>(0));
|
|
};
|
|
|
|
template <class T>
|
|
constexpr inline bool AuHasemplace_v = true;//AuHasemplace<T>::type::value;
|
|
|
|
template <class T>
|
|
struct AuHasfind
|
|
{
|
|
template <class C> static constexpr AuTrueType Test(decltype(static_cast<typename C::const_iterator(C:: *)(const typename C::key_type &) const>(&C::find)));
|
|
template <class C> static constexpr AuTrueType Test(decltype(static_cast<typename C::const_iterator(C:: *)(const typename C::element_type &) const>(&C::find)));
|
|
template <class C> static constexpr AuFalseType Test(...);
|
|
using type = decltype(Test<T>(0));
|
|
};
|
|
|
|
template <class T>
|
|
constexpr inline bool AuHasfind_v = AuHasfind<T>::type::value;
|
|
|
|
template <class T>
|
|
struct AuHasFind
|
|
{
|
|
template <class C> static constexpr AuTrueType Test(decltype(static_cast<typename C::const_iterator(C:: *)(const typename C::key_type &) const>(&C::Find)));
|
|
template <class C> static constexpr AuTrueType Test(decltype(static_cast<typename C::const_iterator(C:: *)(const typename C::element_type &) const>(&C::Find)));
|
|
template <class C> static constexpr AuFalseType Test(...);
|
|
using type = decltype(Test<T>(0));
|
|
};
|
|
|
|
template <class T>
|
|
constexpr inline bool AuHasFind_v = AuHasFind<T>::type::value;
|
|
|
|
template <class T>
|
|
struct AuHasend
|
|
{
|
|
template <class C> static constexpr AuTrueType Test(decltype(static_cast<typename C::const_iterator(C:: *)() const>(&C::end)));
|
|
template <class C> static constexpr AuFalseType Test(...);
|
|
using type = decltype(Test<T>(0));
|
|
};
|
|
|
|
template <class T>
|
|
constexpr inline bool AuHasend_v = AuHasend<T>::type::value;
|
|
|
|
template <class T>
|
|
struct AuHasEnd
|
|
{
|
|
template <class C> static constexpr AuTrueType Test(decltype(static_cast<typename C::const_iterator(C:: *)() const>(&C::End)));
|
|
template <class C> static constexpr AuFalseType Test(...);
|
|
using type = decltype(Test<T>(0));
|
|
};
|
|
|
|
template <class T>
|
|
constexpr inline bool AuHasEnd_v = AuHasEnd<T>::type::value;
|
|
|
|
template <class T>
|
|
struct AuHasbegin
|
|
{
|
|
template <class C> static constexpr AuTrueType Test(decltype(static_cast<typename C::const_iterator(C:: *)() const>(&C::begin)));
|
|
template <class C> static constexpr AuFalseType Test(...);
|
|
using type = decltype(Test<T>(0));
|
|
};
|
|
|
|
template <class T>
|
|
constexpr inline bool AuHasbegin_v = AuHasbegin<T>::type::value;
|
|
|
|
template <class T>
|
|
struct AuHasBegin
|
|
{
|
|
template <class C> static constexpr AuTrueType Test(decltype(static_cast<typename C::const_iterator(C:: *)() const>(&C::Begin)));
|
|
template <class C> static constexpr AuFalseType Test(...);
|
|
using type = decltype(Test<T>(0));
|
|
};
|
|
|
|
template <class T>
|
|
constexpr inline bool AuHasBegin_v = AuHasBegin<T>::type::value;
|
|
}
|
|
|
|
#include <auROXTL/auResult.hpp>
|
|
#include <auROXTL/auMemoryModel.hpp>
|
|
#include <auROXTL/auOptionalEx.hpp>
|
|
#include <auROXTL/auString.hpp>
|
|
#include <auROXTL/auUTF8StringView.hpp>
|
|
#include <auROXTL/auFunctional.hpp>
|
|
#include <auROXTL/auArray.hpp>
|
|
#include <auROXTL/auList.hpp>
|
|
#include <auROXTL/auHashMap.hpp>
|
|
#include <auROXTL/auBST.hpp>
|
|
#include <auROXTL/auTuple.hpp>
|
|
#include <auROXTL/auOptional.hpp>
|
|
#include <auROXTL/auVector.hpp>
|
|
#include <auROXTL/auArrayList.hpp>
|
|
|
|
namespace Aurora::Memory
|
|
{
|
|
inline void ThrowNullException()
|
|
{
|
|
AU_THROW_STRING("ExSharedPointer Null Access Violation");
|
|
}
|
|
}
|
|
|
|
#if defined(AURORA_COMPILER_MSVC)
|
|
using AuAtomicInt = long;
|
|
#else
|
|
using AuAtomicInt = int;
|
|
#endif
|
|
|
|
|
|
using AuStreamReadWrittenPair_t = AuPair<AuUInt32, AuUInt32>;
|
|
|
|
using AuThreadId_t = AuUInt64;
|
|
static const AuThreadId_t kThreadIdSpecialMask = AuThreadId_t(1) << AuThreadId_t(63); |