diff options
| author | Hannes Schulze <haschu0103@outlook.de> | 2025-02-06 19:54:38 +0100 |
|---|---|---|
| committer | Hannes Schulze <haschu0103@outlook.de> | 2025-02-06 19:54:38 +0100 |
| commit | 64ebfde8bcd6408e3b6925624e8680c314db6efc (patch) | |
| tree | b969314f909f7f16ef5acc63f90dca317a40850a /lib/nes/common/containers/box.hh | |
| parent | d060e3a50c987d10799ccc739bdbf9d7d7a13c10 (diff) | |
get rid of nasty stdlib
Diffstat (limited to 'lib/nes/common/containers/box.hh')
| -rw-r--r-- | lib/nes/common/containers/box.hh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/nes/common/containers/box.hh b/lib/nes/common/containers/box.hh index 7bf2848..82f6448 100644 --- a/lib/nes/common/containers/box.hh +++ b/lib/nes/common/containers/box.hh @@ -2,6 +2,8 @@ #include "nes/common/types.hh" #include "nes/common/debug.hh" +#include "nes/common/utils.hh" +#include <new> namespace nes { @@ -56,15 +58,15 @@ namespace nes operator bool() const { return has_value(); } auto has_value() const -> bool { return initialized_; } - auto get() -> T* { return has_value() ? std::launder(reinterpret_cast<T*>(buffer_)) : nullptr; } - auto get() const -> T const* { return has_value() ? std::launder(reinterpret_cast<T const *>(buffer_)) : nullptr; } + auto get() -> T* { return has_value() ? launder(reinterpret_cast<T*>(buffer_)) : nullptr; } + auto get() const -> T const* { return has_value() ? launder(reinterpret_cast<T const *>(buffer_)) : nullptr; } /// Construct a new value in-place, potentially replacing the old value. template<typename... Args> auto emplace(Args&&... args) -> void { clear(); - new (buffer_) T(std::forward<Args>(args)...); + new (buffer_) T(args...); initialized_ = true; } |
