On Mon, 8 Apr 2019 at 06:30, Robert Ramey via Boost
wrote:
LOL - Looks good to me! So now we have std::variant that is guaranteed
to have a valid state with no double buffer BS and no extra overhead.
I'll be curious to hear what otherothers have to say about this.
And here's the boost version as well:
#include
#include <variant>
#include
#include
namespace mp11 = boost::mp11;
struct Foo {
Foo ( ) = delete;
};
template
struct safe_std_variant : public std::variant {
static_assert (
std::conjunction::value, "is not
trivially constructible" );
};
template
struct safe_boost_variant : public boost::variant {
static_assert (
mp11::mp_all::value, "is not
trivially constructible" );
};
int main ( ) {
safe_std_variant sv1; // compiles
safe_boost_variant sv2; // compiles
safe_std_variant sv3; // does not compile
safe_boost_variant sv4; // does not compile
}
degski
--
*Microsoft, please kill Paint3D*