If I have a type that is std::is_nothrow_move_constructible
and I need to store it in a std::any
or std::variant
, which one would you recommend to use and why? Which one will give the least overhead? Edit: What are the different use cases for std::variant
vs std::any
?
class MyType
{
public:
MyType(const MyType&) = default;
MyType(MyType&&) = default;
MyType() = default;
};
int main(int argc, char* argv[])
{
static_assert(std::is_nothrow_move_constructible<MyType>::value, "Not move constructible");
return 0;
}