diff --git a/src/ox/std/error.hpp b/src/ox/std/error.hpp index 2398e6339..b6aee015b 100644 --- a/src/ox/std/error.hpp +++ b/src/ox/std/error.hpp @@ -8,15 +8,12 @@ #pragma once +#include "defines.hpp" #include "strongint.hpp" #include "typetraits.hpp" #include "utility.hpp" -#ifdef DEBUG #define OxError(...) ox::_error(__FILE__, __LINE__, __VA_ARGS__) -#else -#define OxError(...) static_cast(__VA_ARGS__) -#endif namespace ox { @@ -33,15 +30,22 @@ struct BaseError { line = o.line; } + constexpr BaseError operator=(const BaseError &o) noexcept { + msg = o.msg; + file = o.file; + line = o.line; + return *this; + } + }; using Error = Integer; static constexpr Error _error(const char *file, uint32_t line, uint64_t errCode, const char *msg = nullptr) { Error err = static_cast(errCode); - err.file = file; - err.line = line; - err.msg = msg; + err.file = file; + err.line = line; + err.msg = msg; return err; } diff --git a/src/ox/std/strongint.hpp b/src/ox/std/strongint.hpp index 9da34ec97..72a6b7225 100644 --- a/src/ox/std/strongint.hpp +++ b/src/ox/std/strongint.hpp @@ -12,13 +12,24 @@ namespace ox { -class BaseInteger {}; +struct BaseInteger { + + constexpr BaseInteger() = default; + + constexpr BaseInteger(const BaseInteger&) { + } + + constexpr BaseInteger operator=(const BaseInteger&) { + return *this; + } + +}; /** * Integer is a strongly typed integer wrapper used to create strongly typed * integers. */ -template +template class Integer: public Base { private: T m_i; @@ -115,7 +126,9 @@ constexpr Integer::Integer(const Integer &i) noexcept: Base(i) template constexpr Integer Integer::operator=(Integer i) noexcept { - return Integer(m_i = i.m_i); + Base::operator=(i); + m_i = i.m_i; + return *this; } template