blob: a90298ec5c178076ee3047b84d0293f8bd20a56c [file] [log] [blame]
[/
Copyright 2015 John Maddock.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
]
[section:is_constructible is_constructible]
template <class T, class... Args>
struct is_constructible : public __tof {};
__inherit If `T` can be constructed from `Args`,
then inherits from __true_type, otherwise inherits from __false_type. Type `T`
must be a complete type.
Formally the trait answers the question, is the expression:
T t(std::declval<Args>()...);
valid?
There are a number of important special cases for this trait:
is_constructible<T>::value
Indicates whether `T` is default constructible, while:
is_constructible<T, const T&>::value
Indicates whether `T` is copy-constructible, and:
is_constructible<T, T>::value
Indicates whether `T` is move-constructible.
__compat This trait requires the C++11 features `decltype` variadic templates and SFINAE-expression support for full support.
While there is some fallback code for cases where this is not the case, the trait should really be considered broken in that case.
The header will define the macro `BOOST_TT_IS_CONSTRUCTIBLE_CONFORMING` when the full implementation is available.
__header ` #include <boost/type_traits/is_constructible.hpp>` or ` #include <boost/type_traits.hpp>`
[endsect]