Add an Optional::emplace method

This commit is contained in:
Maxime Coste 2016-06-22 22:17:13 +01:00
parent a2d76e27b0
commit a8cf2a84c4

View File

@ -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);