Added operators to BoxedObject, fixed MappintIterator for reference types and fixed signature of custom assertion and error handlers.

This commit is contained in:
2023-11-12 15:25:46 +01:00
parent 2cc0f74d06
commit 7c1dd29a85
4 changed files with 24 additions and 18 deletions

View File

@@ -28,7 +28,7 @@ namespace mijin
#if MIJIN_DEBUG
#define MIJIN_DO_RAISE_ERROR(msg, source_loc) \
#define MIJIN_RAISE_ERROR(msg, source_loc) \
switch (mijin::handleError(msg, source_loc)) \
{ \
case mijin::ErrorHandling::CONTINUE: \
@@ -40,10 +40,8 @@ switch (mijin::handleError(msg, source_loc)) \
std::abort(); \
}
#define MIJIN_RAISE_ERROR(msg, func, file, line) MIJIN_DO_RAISE_ERROR(msg, func, file, line)
#define MIJIN_ERROR(msg) \
MIJIN_DO_RAISE_ERROR(msg, std::source_location::current())
MIJIN_RAISE_ERROR(msg, std::source_location::current())
#define MIJIN_FATAL(msg) \
MIJIN_ERROR(msg) \
@@ -57,7 +55,7 @@ if (!static_cast<bool>(condition))
if (true) /*!ignoreAll */ \
{ \
const mijin::AssertionResult assertion_result__ = mijin::handleAssert( \
#condition, msg, MIJIN_FUNC(), __FILE__, __LINE__); \
#condition, msg, std::source_location::current()); \
switch (assertion_result__) \
{ \
case mijin::AssertionResult::ABORT: \
@@ -116,20 +114,17 @@ enum class ErrorHandling
#ifdef MIJIN_USE_CUSTOM_ASSERTION_HANDLER
AssertionResult handleAssert(const char* condition,
const char* message, const char* function,
const char* file, int line) noexcept;
const char* message, const std::source_location& location);
#else
constexpr AssertionResult handleAssert(const char* /* condition */,
const char* /* message */, const char* /* function */,
const char* /* file */, int /* line */)
const char* /* message */, const std::source_location& /* location */)
{
return AssertionResult::ERROR;
}
#endif // MIJIN_USE_CUSTOM_ASSERTION_HANDLER
#ifdef MIJIN_USE_CUSTOM_ERROR_HANDLER
ErrorHandling handleError(const char* message, const char* function,
const char* file, int line) noexcept;
ErrorHandling handleError(const char* message, const std::source_location& location);
#else
inline ErrorHandling handleError(const char* message, const std::source_location& location) noexcept
{