Use a named struct Empty in optional

This commit is contained in:
Maxime Coste 2015-07-10 19:05:21 +01:00
parent 1d1927647a
commit a15d816ea8

View File

@ -80,9 +80,10 @@ public:
private:
void destruct_ifn() { if (m_valid) m_value.~T(); }
struct Empty {};
union
{
struct {} m_empty; // disable default construction of value
Empty m_empty; // disable default construction of value
T m_value;
};
bool m_valid;