...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
template <class T> struct has_nothrow_constructor : publictrue_type-or-false_type
{}; template <class T> struct has_nothrow_default_constructor : publictrue_type-or-false_type
{};
Inherits: If T is a (possibly cv-qualified)
type with a non-throwing default-constructor then inherits from true_type,
otherwise inherits from false_type.
Type T
must be a complete
type.
These two traits are synonyms for each other.
Compiler Compatibility: Either requires
C++11 noexcept
and decltype
or else some (unspecified) help from
the compiler. Currently (June 2015) compilers more recent than Visual C++
8, GCC-4.3, Greenhills 6.0, Intel-11.0, and Codegear and all recent GCC versions
have the necessary compiler intrinsics
to ensure that this trait "just works". You may test to see if
the necessary support is available by checking to see if defined(BOOST_HAS_NOTHROW_CONSTRUCTOR) || (!defined(BOOST_NO_CXX11_DECLTYPE)
&& !defined(BOOST_NO_CXX11_NOEXCEPT))
is true.
Header: #include
<boost/type_traits/has_nothrow_constructor.hpp>
or #include <boost/type_traits.hpp>