Cleanup to compile without stdex

Signed-off-by: Simon Rozman simon@rozman.si
This commit is contained in:
Simon Rozman 2025-07-02 16:16:07 +02:00
parent 25463aa5fc
commit c2c2d0e6c8

View File

@ -6,6 +6,7 @@
#pragma once #pragma once
#include <stddef.h> #include <stddef.h>
#include <stdexcept>
/// ///
/// Declares a class as non-copyable /// Declares a class as non-copyable
@ -54,7 +55,7 @@ namespace macstd
/// ///
/// \param[in] h Initial object handle value /// \param[in] h Initial object handle value
/// ///
handle(_In_opt_ T h) noexcept : m_h(h) handle(T h) noexcept : m_h(h)
{} {}
/// ///
@ -83,7 +84,7 @@ namespace macstd
/// ///
/// \param[in] h Object handle value /// \param[in] h Object handle value
/// ///
handle<T, TR>& operator=(_In_opt_ T h) noexcept handle<T, TR>& operator=(T h) noexcept
{ {
attach(h); attach(h);
return *this; return *this;
@ -193,7 +194,7 @@ namespace macstd
/// - Non zero when object handle is less than h; /// - Non zero when object handle is less than h;
/// - Zero otherwise. /// - Zero otherwise.
/// ///
bool operator<(_In_opt_ T h) const bool operator<(T h) const
{ {
return m_h < h; return m_h < h;
} }
@ -206,7 +207,7 @@ namespace macstd
/// - Non zero when object handle is less than or equal to h; /// - Non zero when object handle is less than or equal to h;
/// - Zero otherwise. /// - Zero otherwise.
/// ///
bool operator<=(_In_opt_ T h) const bool operator<=(T h) const
{ {
return !operator>(h); return !operator>(h);
} }
@ -219,7 +220,7 @@ namespace macstd
/// - Non zero when object handle is greater than or equal to h; /// - Non zero when object handle is greater than or equal to h;
/// - Zero otherwise. /// - Zero otherwise.
/// ///
bool operator>=(_In_opt_ T h) const bool operator>=(T h) const
{ {
return !operator<(h); return !operator<(h);
} }
@ -232,7 +233,7 @@ namespace macstd
/// - Non zero when object handle is greater than h; /// - Non zero when object handle is greater than h;
/// - Zero otherwise. /// - Zero otherwise.
/// ///
bool operator>(_In_opt_ T h) const bool operator>(T h) const
{ {
return h < m_h; return h < m_h;
} }
@ -245,7 +246,7 @@ namespace macstd
/// - Non zero when object handle is not equal to h; /// - Non zero when object handle is not equal to h;
/// - Zero otherwise. /// - Zero otherwise.
/// ///
bool operator!=(_In_opt_ T h) const bool operator!=(T h) const
{ {
return !operator==(h); return !operator==(h);
} }
@ -258,7 +259,7 @@ namespace macstd
/// - Non zero when object handle is equal to h; /// - Non zero when object handle is equal to h;
/// - Zero otherwise. /// - Zero otherwise.
/// ///
bool operator==(_In_opt_ T h) const bool operator==(T h) const
{ {
return m_h == h; return m_h == h;
} }
@ -280,7 +281,7 @@ namespace macstd
/// ///
/// \param[in] h New object handle /// \param[in] h New object handle
/// ///
void attach(_In_opt_ T h) noexcept void attach(T h) noexcept
{ {
if (m_h != TR::invalid) if (m_h != TR::invalid)
TR::free(m_h); TR::free(m_h);
@ -292,7 +293,7 @@ namespace macstd
/// ///
/// \param[in] h Object handle of existing object /// \param[in] h Object handle of existing object
/// ///
void attach_duplicated(_In_opt_ T h) void attach_duplicated(T h)
{ {
if (this->m_h != TR::invalid) if (this->m_h != TR::invalid)
TR::free(this->m_h); TR::free(this->m_h);
@ -353,7 +354,7 @@ namespace macstd
/// \param[in] num Numeric error code /// \param[in] num Numeric error code
/// \param[in] msg Error message /// \param[in] msg Error message
/// ///
num_runtime_error(error_type num, _In_z_ const char *msg) : num_runtime_error(error_type num, const char *msg) :
m_num(num), m_num(num),
runtime_error(msg) runtime_error(msg)
{} {}