On Mon, 8 Apr 2019 at 07:45, degski wrote:
Just now I'm at it:
Well, a bit too quick maybe:
#include
#include <variant>
#include
#include
namespace mp11 = boost::mp11;
struct Foo {
Foo ( ) = delete;
};
struct Bar {
Bar & operator= ( const Bar & ) = 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" );
};
template
struct evensafer_std_variant : public std::variant {
static_assert (
std::conjunction,
std::conjunction>::value,
"is not nothrow constructible or not nothrow copy
assignable" );
};
template
struct evensafer_boost_variant : public boost::variant {
static_assert (
mp11::mp_all,
mp11::mp_all>::value,
"is not nothrow constructible or not nothrow copy
assignable" );
};
int main ( ) {
safe_std_variant sv1; // compiles
safe_boost_variant sv2; // compiles
evensafer_std_variant sv3; // compiles
evensafer_boost_variant sv4; // compiles
safe_std_variant sv5; // does not
compile
safe_boost_variant sv6; // does not
compile
evensafer_std_variant sv7; // does not
compile
evensafer_boost_variant sv8; // does not
compile
safe_std_variant sv9; // does compile
safe_boost_variant sv10; // does compile
evensafer_std_variant sv11; // does not
compile
evensafer_boost_variant sv12; // does not
compile
}
degski
--
*Microsoft, please kill Paint3D*