8 Apr
2019
8 Apr
'19
6:49 p.m.
pon., 8 kwi 2019 o 19:55 Peter Dimov via Boost
Andrzej Krzemienski wrote:
Such thing could be achieved if the behavior of variant's assignment and emplacement was controlled by a type trait. The default implementation for unfriendly types would be compile-time error; but users would be able to specialize it for their instantiations of variant in order to assign different semantics: double buffering, or setting the valueless_by_exception state.
This can't work in general. If you have
template
class lib1::X { private: variant
state_; }; and
template
class lib2::Y { private: variant
state_; }; it's not possible for lib1 and lib2 to choose their preferred variant behaviors independently of one another.
Indeed. Good point. Regards, &rzej;