The following code will fail to compile on most compilers:
#include <type_traits>
class Foo
{
public:
Foo() noexcept {}
~Foo() noexcept(false) {}
};
static_assert(std::is_nothrow_default_constructible_v<Foo>);
CppReference also states that this is common in compiler implementations, but provides no alternative. How can I test if a constructor is noexcept without the destructor influencing the result?
Aucun commentaire:
Enregistrer un commentaire