summaryrefslogtreecommitdiff
path: root/lib/nes/common/containers/box.hh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/nes/common/containers/box.hh')
-rw-r--r--lib/nes/common/containers/box.hh8
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;
}