I am writing a test driver for a type this is explicitly supposed to not be default constructable. Is there any way to assert in my test driver that this is the case? I can verify manually via compilation errors, but I want something that will protect against future changes that may misguidedly add a default constructor.
Edit: I'm stuck in an environment with C++03. Keeping that in mind, are there any other options than is_default_constructable
?
You can use static_assert(!std::is_default_constructible<T>::value, "Boo");
. Make sure to #include <type_traits>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With