Add an Optional::emplace method
This commit is contained in:
parent
a2d76e27b0
commit
a8cf2a84c4
|
@ -60,6 +60,14 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
void emplace(Args&&... args)
|
||||
{
|
||||
destruct_ifn();
|
||||
new (&m_value) T{std::forward<Args>(args)...};
|
||||
m_valid = true;
|
||||
}
|
||||
|
||||
T& operator*()
|
||||
{
|
||||
kak_assert(m_valid);
|
||||
|
|
Loading…
Reference in New Issue
Block a user