[*] nuked even more of the stl dependency

[-] std::forward
This commit is contained in:
Reece Wilson 2022-01-19 18:30:57 +00:00
parent 6b9bddeeaf
commit 1fac842e24
9 changed files with 42 additions and 30 deletions

View File

@ -105,7 +105,7 @@ namespace Aurora::Async
return DispatchWork<std::tuple<AuSPtr<Clazz_t>, Args...>, ReturnValue_t>(worker,
TaskFromTupleCallableWithBindOwner2<FTask<AuTuple<AuSPtr<Clazz_t>, Args...>, ReturnValue_t>, ReturnValue_t, FunctorTask_t>(task),
Async::JobFromTupleClazz<ReturnValue_t, AuSPtr<Clazz_t>, Args...>(job),
AuMakeTuple<AuSPtr<Clazz_t>, Args...>(AU_FWD(owner), std::forward<Args>(in)...),
AuMakeTuple<AuSPtr<Clazz_t>, Args...>(AU_FWD(owner), AuForward<Args>(in)...),
false);
}
@ -115,7 +115,7 @@ namespace Aurora::Async
return DispatchWork<std::tuple<AuSPtr<Clazz_t>, Args...>, ReturnValue_t>(worker,
TaskFromTupleCallableWithBindOwner2<FTask<AuTuple<AuSPtr<Clazz_t>, Args...>, ReturnValue_t>, ReturnValue_t, FunctorTask_t>(task),
Async::JobFromTupleClazzEx<ReturnValue_t, AuSPtr<Clazz_t>, Args...>(success, failure),
AuMakeTuple<AuSPtr<Clazz_t>, Args...>(AU_FWD(owner), std::forward<Args>(in)...),
AuMakeTuple<AuSPtr<Clazz_t>, Args...>(AU_FWD(owner), AuForward<Args>(in)...),
false);
}
}

View File

@ -33,26 +33,26 @@ namespace Aurora::Console::Logging
template<typename ... T>
inline void WriteLinef(AuUInt8 level, const AuString &tag, const AuString &msg, T&& ... args)
{
WriteMessage(level, ConsoleMessage(EAnsiColor::eReset, tag, fmt::format(msg, std::forward<T>(args)...)));
WriteMessage(level, ConsoleMessage(EAnsiColor::eReset, tag, fmt::format(msg, AuForward<T>(args)...)));
}
template<typename ... T>
inline void WriteLinef(AuUInt8 level, EAnsiColor color, const AuString &tag, const AuString &msg, T&& ... args)
{
WriteMessage(level, ConsoleMessage(color, tag, fmt::format(msg, std::forward<T>(args)...)));
WriteMessage(level, ConsoleMessage(color, tag, fmt::format(msg, AuForward<T>(args)...)));
}
template<typename ... T>
inline void LogVerbose(const AuString &line, T&& ... args)
{
WriteLinef(static_cast<AuUInt8>(ELogLevel::eVerbose), EAnsiColor::eYellow, "Verbose", line, std::forward<T>(args)...);
WriteLinef(static_cast<AuUInt8>(ELogLevel::eVerbose), EAnsiColor::eYellow, "Verbose", line, AuForward<T>(args)...);
}
#if defined(STAGING) || defined(DEBUG)
template<typename ... T>
inline void LogVerboseNoShip(const AuString &line, T&& ... args)
{
WriteLinef(static_cast<AuUInt8>(ELogLevel::eVerbose), EAnsiColor::eYellow, "Verbose", line, std::forward<T>(args)...);
WriteLinef(static_cast<AuUInt8>(ELogLevel::eVerbose), EAnsiColor::eYellow, "Verbose", line, AuForward<T>(args)...);
}
#else
template<typename ... T>
@ -68,31 +68,31 @@ namespace Aurora::Console::Logging
template<typename ... T>
inline void LogInfo(const AuString &line, T&& ... args)
{
WriteLinef(static_cast<AuUInt8>(ELogLevel::eInfo), EAnsiColor::eGreen, "Info", line, std::forward<T>(args)...);
WriteLinef(static_cast<AuUInt8>(ELogLevel::eInfo), EAnsiColor::eGreen, "Info", line, AuForward<T>(args)...);
}
template<typename ... T>
inline void LogDbg(const AuString &line, T&& ... args)
{
WriteLinef(static_cast<AuUInt8>(ELogLevel::eDebug), EAnsiColor::eYellow, "Debug", line, std::forward<T>(args)...);
WriteLinef(static_cast<AuUInt8>(ELogLevel::eDebug), EAnsiColor::eYellow, "Debug", line, AuForward<T>(args)...);
}
template<typename ... T>
inline void LogWarn(const AuString &line, T&& ... args)
{
WriteLinef(static_cast<AuUInt8>(ELogLevel::eWarn), EAnsiColor::eRed, "Warn", line, std::forward<T>(args)...);
WriteLinef(static_cast<AuUInt8>(ELogLevel::eWarn), EAnsiColor::eRed, "Warn", line, AuForward<T>(args)...);
}
template<typename ... T>
inline void LogError(const AuString &line, T&& ... args)
{
WriteLinef(static_cast<AuUInt8>(ELogLevel::eError), EAnsiColor::eBoldRed, "Error", line, std::forward<T>(args)...);
WriteLinef(static_cast<AuUInt8>(ELogLevel::eError), EAnsiColor::eBoldRed, "Error", line, AuForward<T>(args)...);
}
template<typename ... T>
inline void LogGame(const AuString &line, T&& ... args)
{
WriteLinef(static_cast<AuUInt8>(ELogLevel::eVerbose), EAnsiColor::eBlue, "Game", line, std::forward<T>(args)...);
WriteLinef(static_cast<AuUInt8>(ELogLevel::eVerbose), EAnsiColor::eBlue, "Game", line, AuForward<T>(args)...);
}
#endif
};

View File

@ -18,26 +18,26 @@ namespace Aurora::Console::Logging
template<typename ... T>
static void WriteLinef(const AuString &tag, const AuString &msg, T&& ... args)
{
WriteLine(ConsoleMessage(EAnsiColor::eReset, tag, fmt::format(msg, std::forward<T>(args)...)));
WriteLine(ConsoleMessage(EAnsiColor::eReset, tag, fmt::format(msg, AuForward<T>(args)...)));
}
template<typename ... T>
static void WriteLinef(EAnsiColor color, const AuString &tag, const AuString &msg, T&& ... args)
{
WriteLine(ConsoleMessage(color, tag, fmt::format(msg, std::forward<T>(args)...)));
WriteLine(ConsoleMessage(color, tag, fmt::format(msg, AuForward<T>(args)...)));
}
template<typename ... T>
static void LogVerbose(const AuString &line, T&& ... args)
{
WriteLinef(EAnsiColor::eYellow, "Verbose", line, std::forward<T>(args)...);
WriteLinef(EAnsiColor::eYellow, "Verbose", line, AuForward<T>(args)...);
}
#if defined(STAGING) || defined(DEBUG)
template<typename ... T>
static void LogVerboseNoShip(const AuString &line, T&& ... args)
{
WriteLinef(EAnsiColor::eYellow, "Verbose", line, std::forward<T>(args)...);
WriteLinef(EAnsiColor::eYellow, "Verbose", line, AuForward<T>(args)...);
}
#else
#define LogVerboseNoShip(...) DoNothing()
@ -51,31 +51,31 @@ namespace Aurora::Console::Logging
template<typename ... T>
static void LogInfo(const AuString &line, T&& ... args)
{
WriteLinef(EAnsiColor::eGreen, "Info", line, std::forward<T>(args)...);
WriteLinef(EAnsiColor::eGreen, "Info", line, AuForward<T>(args)...);
}
template<typename ... T>
static void LogDbg(const AuString &line, T&& ... args)
{
WriteLinef(EAnsiColor::eYellow, "Debug", line, std::forward<T>(args)...);
WriteLinef(EAnsiColor::eYellow, "Debug", line, AuForward<T>(args)...);
}
template<typename ... T>
static void LogWarn(const AuString &line, T&& ... args)
{
WriteLinef(EAnsiColor::eRed, "Warn", line, std::forward<T>(args)...);
WriteLinef(EAnsiColor::eRed, "Warn", line, AuForward<T>(args)...);
}
template<typename ... T>
static void LogError(const AuString &line, T&& ... args)
{
WriteLinef(EAnsiColor::eBoldRed, "Error", line, std::forward<T>(args)...);
WriteLinef(EAnsiColor::eBoldRed, "Error", line, AuForward<T>(args)...);
}
template<typename ... T>
static void LogGame(const AuString &line, T&& ... args)
{
WriteLinef(EAnsiColor::eBlue, "Game", line, std::forward<T>(args)...);
WriteLinef(EAnsiColor::eBlue, "Game", line, AuForward<T>(args)...);
}
#else
@ -131,7 +131,7 @@ namespace Aurora::Console::Logging
template<typename ... T> \
static void AuLog ## level(T&& ... args) \
{ \
Aurora::Console::Logging::Log ## level(std::forward<T>(args)...); \
Aurora::Console::Logging::Log ## level(AuForward<T>(args)...); \
}
ADD_AU_GLOBAL_ALIAS(Info)

View File

@ -14,7 +14,7 @@ namespace Aurora::Debug
AuOptional<AuString> label;
AuUInt64 address;
AuOptional<AuString> module;
AuOptional<std::tuple<AuString, int, int>> file; // file, line, offset
AuOptional<AuTuple<AuString, int, int>> file; // file, line, offset
AUKN_SYM AuString Stringify() const;
};

View File

@ -37,7 +37,7 @@ namespace Aurora::Debug
static AU_NOINLINE void ErrorMakeNested(const AuString &msg, T&& ... args) _FREECOMPILER_OPTIMIZE_OFF
{
#if defined(_AUHAS_FMT)
_PushError(_DBG_RET_ADDR, EFailureCategory::kFailureNested, fmt::format(msg, std::forward<T>(args)...).c_str());
_PushError(_DBG_RET_ADDR, EFailureCategory::kFailureNested, fmt::format(msg, AuForward<T>(args)...).c_str());
#else
_PushError(_DBG_RET_ADDR, EFailureCategory::kFailureNested, nullptr);
#endif
@ -53,7 +53,7 @@ namespace Aurora::Debug
else
{
#if defined(_AUHAS_FMT)
_PushError(_DBG_RET_ADDR, category, fmt::format(msg, std::forward<T>(args)...).c_str());
_PushError(_DBG_RET_ADDR, category, fmt::format(msg, AuForward<T>(args)...).c_str());
#else
_PushError(_DBG_RET_ADDR, category, "Missing dependency");
#endif

View File

@ -11,7 +11,7 @@
template<typename ... T>
static inline void __declspec(noreturn) SysPanic(T... args)
{
Aurora::Console::Logging::WriteLinef(Aurora::Console::EAnsiColor::eBoldRed, "Fatal", std::forward<T>(args)...);
Aurora::Console::Logging::WriteLinef(Aurora::Console::EAnsiColor::eBoldRed, "Fatal", AuForward<T>(args)...);
Aurora::Debug::Panic();
}
#endif

View File

@ -158,7 +158,6 @@ constexpr AuRemoveReference_t<T> &&AuMove(T &&arg) noexcept
return static_cast<AuRemoveReference_t<T> &&>(arg);
}
template<bool Test, class T = void>
struct AuEnableIf
{
@ -189,6 +188,19 @@ struct AuConditional<false, T, T2>
template<bool Test, class T, class T2>
using AuConditional_t = typename AuConditional<Test, T, T2>::type;
template <class T>
constexpr T &&AuForward(AuRemoveReference_t<T> &arg) noexcept
{
return static_cast<T &&>(arg);
}
template <class T>
constexpr T &&AuForward(AuRemoveReference_t<T> &&arg) noexcept
{
//static_assert(!is_lvalue_reference_v<T>, "bad forward call");
return static_cast<T &&>(arg);
}
#if !defined(AURORA_RUNTIME_AU_LIST)
#define AURORA_RUNTIME_AU_LIST std::vector

View File

@ -16,7 +16,7 @@ static auline AuSPtr<T> AuMakeShared(Args&&... args)
{
try
{
return AURORA_RUNTIME_MAKE_SHARED<T>(std::forward<Args>(args)...);
return AURORA_RUNTIME_MAKE_SHARED<T>(AuForward<Args>(args)...);
}
catch (...)
{
@ -31,7 +31,7 @@ static auline AuSPtr<T> AuMakeShared(Args&&... args)
template<typename... Args>
static auline auto AuMakePair(Args&&... args)
{
return AURORA_RUNTIME_MAKE_PAIR(std::forward<Args>(args)...);
return AURORA_RUNTIME_MAKE_PAIR(AuForward<Args>(args)...);
}
@ -42,7 +42,7 @@ static auline auto AuMakePair(Args&&... args)
template<typename... Args>
static auline auto AuMakeTuple(Args&&... args)
{
return AURORA_RUNTIME_MAKE_TUPLE(std::forward<Args>(args)...);
return AURORA_RUNTIME_MAKE_TUPLE(AuForward<Args>(args)...);
}

View File

@ -184,7 +184,7 @@ namespace Aurora::Crypto::X509
}) == 0 && ok;
}
static int x509_get_crt_ext(mbedtls_x509_crt *crt, const char *oid, int oidLength, std::function<void(mbedtls_x509_buf &ex, unsigned char **, unsigned char *)> cb)
static int x509_get_crt_ext(mbedtls_x509_crt *crt, const char *oid, int oidLength, AuFunction<void(mbedtls_x509_buf &ex, unsigned char **, unsigned char *)> cb)
{
int ret = 0;
size_t len;