[*] Update AU_THROW_STRING to throw an exception when possible

This commit is contained in:
Reece Wilson 2022-04-04 06:10:16 +01:00
parent 4fa7f61b8f
commit f4f98cec83
2 changed files with 26 additions and 2 deletions

View File

@ -136,8 +136,30 @@
#define AU_FWD(var) AuForward<decltype(var)>(var)
#endif
#if defined(_AURORA_MISSING_STD_EXCEPTION)
#define AuStringException AuString
#else
struct AuStringException : std::exception
{
inline AuStringException (const char *str) : pNullString(str)
{
}
const char *what() const noexcept override
{
return pNullString;
}
const char *pNullString;
};
#endif
#if !defined(AU_THROW_STRING)
#define AU_THROW_STRING(var) throw AuString(var)
#define AU_THROW_STRING(var) throw AuStringException(var)
#endif
#define AU_ITERATE_ARRAY(index, arry) AuUInt index = 0; index < AuArraySize(arry); index++

View File

@ -70,4 +70,6 @@
//
////////////////////////////////////////////////////////////////////////////////////////////////
//#define _AURORA_NULLEXPT_USE_TRY_EMPLACE_AFTER_FIND
//#define _AURORA_NULLEXPT_USE_TRY_EMPLACE_AFTER_FIND
//#define _AURORA_MISSING_STD_EXCEPTION