diff --git a/src/optional.hh b/src/optional.hh index 3aa3676f..a4d15ff5 100644 --- a/src/optional.hh +++ b/src/optional.hh @@ -60,6 +60,14 @@ public: return false; } + template + void emplace(Args&&... args) + { + destruct_ifn(); + new (&m_value) T{std::forward(args)...}; + m_valid = true; + } + T& operator*() { kak_assert(m_valid);