diff --git a/doc/html/boost_typetraits/history.html b/doc/html/boost_typetraits/history.html index 45954e9..9a7e09a 100644 --- a/doc/html/boost_typetraits/history.html +++ b/doc/html/boost_typetraits/history.html @@ -41,6 +41,13 @@ Fix decay to follow C++11 semantics, see #7760. +
![]() |
-Home | -Libraries | -People | -FAQ | -More | -
- #include <boost/type_traits/common_type.hpp>
-
namespace boost { - template <class ...T> struct common_type; -} --
- common_type - is a traits class used to deduce a type common to a several types, useful - as the return type of functions operating on multiple input types such as - in mixed-mode arithmetic.. -
-
- The nested typedef ::type
- could be defined as follows:
-
template <class ...T> -struct common_type; - -template <class T, class U, class ...V> -struct common_type<T,U,...V> { - typedef typename __common_type__<typename __common_type__<T, U>::type, V...>::type type; -}; - -template <class T> -struct common_type<T> { - typedef T type; -}; - -template <class T, class U> -struct common_type<T, U> { - typedef decltype(__declval__<bool>() ? __declval__<T>() : __declval__<U>()) type; -}; --
- All parameter types must be complete. This trait is permitted to be specialized - by a user if at least one template parameter is a user-defined type. Note: Such specializations are required when only - explicit conversions are desired among the common_type - arguments. -
-- When the compiler does not support static assertions then the user can select - the way static assertions are reported. Define -
-- The default behavior is to use mpl assertions in this case, but setting BOOST_COMMON_TYPE_USES_STATIC_ASSERT - may reduce compile times and header dependencies somewhat. -
-- Depending on the static assertion used you will have an hint of the failing - assertion either through the symbol or through the text. -
-
- When possible common_type is implemented using decltype
.
- Otherwise when BOOST_COMMON_TYPE_DONT_USE_TYPEOF is not defined it uses Boost.TypeOf.
-
- | - |
![]() |
+Home | +Libraries | +People | +FAQ | +More | +
template <class T, class U>
+struct copy_cv
+{
+ typedef see-below
type;
+};
+
+
+ type: T cv
,
+ where cv are the cv-qualifiers of U
.
+
+ Header: #include
+ <boost/type_traits/copy_cv.hpp>
+ or #include <boost/type_traits.hpp>
+
Table 1.17. Examples
+
+ + Expression + + |
+
+ + Result Type + + |
+
---|---|
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+ | + |
![]() |
+Home | +Libraries | +People | +FAQ | +More | +
template <class T> +typename add_rvalue_reference<T>::type declval() noexcept; // as unevaluated operand ++
+ C++ Standard Reference: C++11 20.2.4 [declval]. +
+
+ Header: #include
+ <boost/type_traits/declval.hpp>
+ or #include <boost/type_traits.hpp>
+
+ The function template declval
+ is used when a value of a certain type is required in a type computation
+ context. For example, the type of the result of adding an int
+ and a float
can be obtained
+ with the expression decltype( declval<int>()
+ + declval<float>() )
.
+
+ | + |
![]() |
+Home | +Libraries | +People | +FAQ | +More | +
template <class T>
+struct has_nothrow_destructor : public true_type-or-false_type
{};
+
+
+ Inherits: If T is a (possibly cv-qualified)
+ type with a non-throwing destructor then inherits from true_type,
+ otherwise inherits from false_type.
+ Type T
must be a complete
+ type.
+
+ Compiler Compatibility: Either requires
+ C++11 noexcept
and decltype
or else some (unspecified) help from
+ the compiler. You may test to see if the necessary support is available by
+ checking to see if !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_NOEXCEPT)
is true.
+
+ Header: #include
+ <boost/type_traits/has_nothrow_copy.hpp>
+ or #include <boost/type_traits.hpp>
+
![]() |
+Note | +
---|---|
+ Note that destructors are assumed to be non-throwing unless they are explicitly
+ marked otherwise with a |
+ | + |
![]() |
+Home | +Libraries | +People | +FAQ | +More | +
template <class T, class U>
+struct is_assignable : public true_type-or-false_type
{};
+
+
+ Inherits: If std::declval<T>()
+ = std::declval<U>()
+ then inherits from true_type,
+ otherwise from __flase_type. Type T
+ must be a complete type.
+
+ Note that this trait is somewhat tricky to use correctly: for example: +
+is_assignable<int, int>::value ++
+ is false
since std::declval<int>()
+ is an xvalue which can not be assigned to!
+
+ If you're intention is to check for copy-assignment from some type U then + use: +
+is_assignable<T&, const U&>::value ++
+ If you're intention is to check for move-assignment then use: +
+is_assignable<T&, U&&>::value ++
+ or simply: +
+is_assignable<T&, U>::value ++
+ Compiler Compatibility: Requires the C++11
+ features decltype
and SFINAE-expressions
+ for full support.
+
+ Header: #include
+ <boost/type_traits/is_assignable.hpp>
+ or #include <boost/type_traits.hpp>
+
+ | + |
![]() |
+Home | +Libraries | +People | +FAQ | +More | +
template <class T, class... Args>
+struct is_constructible : public true_type-or-false_type
{};
+
+
+ Inherits: 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.
+
+ Compiler Compatibility: 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.
+
+ Header: #include
+ <boost/type_traits/is_copy_constructible.hpp>
+ or #include <boost/type_traits.hpp>
+
+ | + |
![]() |
+Home | +Libraries | +People | +FAQ | +More | +
template <class T>
+struct is_default_constructible : public true_type-or-false_type
{};
+
+
+ Inherits: If T
+ can be default-constructed then inherits from true_type,
+ otherwise inherits from false_type.
+ Type T
must be a complete
+ type.
+
+ Compiler Compatibility: This trait requires
+ the C++11 feature decltype
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.
+
+ Header: #include
+ <boost/type_traits/is_copy_constructible.hpp>
+ or #include <boost/type_traits.hpp>
+
+ | + |
![]() |
+Home | +Libraries | +People | +FAQ | +More | +
template <class T>
+struct is_destructible : public true_type-or-false_type
{};
+
+
+ Inherits: If T
+ does not have its destructor deleted then inherits from true_type,
+ otherwise inherits from false_type.
+ Type T
must be a complete
+ type.
+
+ Compiler Compatibility: This trait requires
+ the C++11 features decltype
+ 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.
+
+ Header: #include
+ <boost/type_traits/is_copy_constructible.hpp>
+ or #include <boost/type_traits.hpp>
+
+ | + |
![]() |
+Home | +Libraries | +People | +FAQ | +More | +
template <class T> +struct type_identity +{ + typedef T type; +}; ++
+ Header: #include
+ <boost/type_traits/type_identity.hpp>
+ or #include <boost/type_traits.hpp>
+
Table 1.33. Examples
+
+ + Expression + + |
+
+ + Result Type + + |
+
---|---|
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+ | + |
A B C D E F H I M N O P R T U V
check
+ +common_type
Operator Type Traits