Use a named struct Empty in optional
This commit is contained in:
parent
1d1927647a
commit
a15d816ea8
|
@ -80,9 +80,10 @@ public:
|
||||||
private:
|
private:
|
||||||
void destruct_ifn() { if (m_valid) m_value.~T(); }
|
void destruct_ifn() { if (m_valid) m_value.~T(); }
|
||||||
|
|
||||||
|
struct Empty {};
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct {} m_empty; // disable default construction of value
|
Empty m_empty; // disable default construction of value
|
||||||
T m_value;
|
T m_value;
|
||||||
};
|
};
|
||||||
bool m_valid;
|
bool m_valid;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user