forked from boostorg/type_traits
Merge branch 'develop'
This commit is contained in:
97
changes pending.txt
Normal file
97
changes pending.txt
Normal file
@ -0,0 +1,97 @@
|
||||
* = PR requests not yet applied to 'develop' branch
|
||||
|
||||
ANY
|
||||
~~~
|
||||
|
||||
Missing mpl/if.hpp https://github.com/boostorg/any/pull/4 DM
|
||||
|
||||
DETAIL
|
||||
------
|
||||
|
||||
Remove unnecessary include for deprecated ice_xxx.hpp header: https://github.com/boostorg/detail/pull/6 DM
|
||||
Remove dependency on deprecated type_trait headers: https://github.com/boostorg/detail/pull/8 D
|
||||
|
||||
FOREACH
|
||||
~~~~~~~
|
||||
|
||||
Relies on conversion from integral_constant* to mpl::bool_*
|
||||
https://github.com/boostorg/foreach/pull/3 DM
|
||||
|
||||
FUNCTION
|
||||
--------
|
||||
|
||||
Removed dependencies on ice_xxx.hpp headers: https://github.com/boostorg/function/pull/5 DM
|
||||
Use ! operator directly rather than boost::mpl::not with Boost supported compilers:
|
||||
https://github.com/boostorg/function/pull/8 DM
|
||||
|
||||
FUSION
|
||||
------
|
||||
|
||||
Deprecated header usage: https://github.com/boostorg/fusion/pull/77 DM
|
||||
|
||||
FUNCTION_TYPES
|
||||
--------------
|
||||
|
||||
Removed dependency on deprecated template_arity_spec.hpp: https://github.com/boostorg/function_types/pull/2 DM
|
||||
Remove use of deprecated header: https://github.com/boostorg/function_types/pull/4 DM
|
||||
|
||||
GRAPH
|
||||
~~~~~
|
||||
|
||||
* Needs to remove ice_or usage: https://github.com/boostorg/graph/pull/30
|
||||
|
||||
ITERATOR
|
||||
~~~~~~~~
|
||||
|
||||
* is_lvalue_iterator.hpp needs to include mpl/bool.hpp
|
||||
https://github.com/boostorg/iterator/pull/11 DM
|
||||
* Removed reliance on deprecated type traits headers: https://github.com/boostorg/iterator/pull/14 DM
|
||||
|
||||
LAMBDA
|
||||
~~~~~~
|
||||
|
||||
Missing includes:
|
||||
ice.hpp see https://github.com/boostorg/lambda/pull/3 DM
|
||||
Lots of headers: https://github.com/boostorg/lambda/pull/4 DM
|
||||
Changes for type_traits Version2: https://github.com/boostorg/lambda/pull/9 DM
|
||||
|
||||
LEXICAL_CAST
|
||||
~~~~~~~~~~~
|
||||
missing is_float.hpp in converter_numeric.hpp https://github.com/boostorg/lexical_cast/pull/8 DM
|
||||
Use mpl instead of ice_ functionality: https://github.com/boostorg/lexical_cast/pull/11 DM
|
||||
Change to use operators rather than mpl equivalents for constant boolean values, in the replacements
|
||||
eliminating dependency on deprecated type_traits headers:
|
||||
https://github.com/boostorg/lexical_cast/pull/15 DM
|
||||
|
||||
|
||||
PYTHON
|
||||
------
|
||||
|
||||
deprecated header usage: https://github.com/boostorg/python/pull/23 DM
|
||||
|
||||
RANDOM
|
||||
~~~~~~
|
||||
|
||||
Missing #includes: https://github.com/boostorg/random/pull/13 DM
|
||||
|
||||
RANGE
|
||||
-----
|
||||
|
||||
Remove dependency on type traits ice_xxx.hpp headers, which are deprecated:
|
||||
https://github.com/boostorg/range/pull/27 DM
|
||||
Use operator || rather than boost::mpl::or_ for constant boolean expression:
|
||||
https://github.com/boostorg/range/pull/31 D
|
||||
|
||||
TEST
|
||||
----
|
||||
|
||||
Add needed MPL header file:
|
||||
https://github.com/boostorg/test/pull/58 DM
|
||||
|
||||
VARIANT
|
||||
-------
|
||||
|
||||
Removed reliance on deprecated type_traits header: https://github.com/boostorg/variant/pull/12 DM
|
||||
|
||||
Unexplained new failures
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
@ -17,10 +17,6 @@ __type The same type as `T const` for all `T`.
|
||||
|
||||
__std_ref 3.9.3.
|
||||
|
||||
__compat If the compiler does not support partial specialization of class-templates
|
||||
then this template will compile, but the member `type` will always be the same as
|
||||
type `T` except where __transform_workaround have been applied.
|
||||
|
||||
__header ` #include <boost/type_traits/add_const.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
@ -37,5 +33,7 @@ __header ` #include <boost/type_traits/add_const.hpp>` or ` #include <boost/type
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -17,10 +17,6 @@ __type The same type as `T const volatile` for all `T`.
|
||||
|
||||
__std_ref 3.9.3.
|
||||
|
||||
__compat If the compiler does not support partial specialization of class-templates
|
||||
then this template will compile, but the member `type` will always be the same as
|
||||
type `T` except where __transform_workaround have been applied.
|
||||
|
||||
__header ` #include <boost/type_traits/add_cv.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
@ -37,5 +33,7 @@ __header ` #include <boost/type_traits/add_cv.hpp>` or ` #include <boost/type_tr
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -19,10 +19,6 @@ the member typedef type shall name `U&`; otherwise, type shall name `T`.
|
||||
|
||||
__std_ref 20.7.6.2.
|
||||
|
||||
__compat If the compiler does not support partial specialization of class-templates
|
||||
then this template will compile, but the member `type` will always be the same as
|
||||
type `T` except where __transform_workaround have been applied.
|
||||
|
||||
__header ` #include <boost/type_traits/add_lvalue_reference.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
@ -43,5 +39,7 @@ __header ` #include <boost/type_traits/add_lvalue_reference.hpp>` or ` #include
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -16,15 +16,11 @@
|
||||
__type The same type as `remove_reference<T>::type*`.
|
||||
|
||||
The rationale for this template
|
||||
is that it produces the same type as `TYPEOF(&t)`,
|
||||
is that it produces the same type as `decltype(&t)`,
|
||||
where `t` is an object of type `T`.
|
||||
|
||||
__std_ref 8.3.1.
|
||||
|
||||
__compat If the compiler does not support partial specialization of class-templates
|
||||
then this template will compile, but the member `type` will always be the same as
|
||||
type `T` except where __transform_workaround have been applied.
|
||||
|
||||
__header ` #include <boost/type_traits/add_pointer.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
@ -41,5 +37,7 @@ __header ` #include <boost/type_traits/add_pointer.hpp>` or ` #include <boost/ty
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -23,10 +23,6 @@ __type If `T` is not a reference type then `T&`, otherwise `T`.
|
||||
|
||||
__std_ref 8.3.2.
|
||||
|
||||
__compat If the compiler does not support partial specialization of class-templates
|
||||
then this template will compile, but the member `type` will always be the same as
|
||||
type `T` except where __transform_workaround have been applied.
|
||||
|
||||
__header ` #include <boost/type_traits/add_reference.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
@ -43,5 +39,7 @@ __header ` #include <boost/type_traits/add_reference.hpp>` or ` #include <boost/
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -21,11 +21,6 @@ reference. -end note\]].
|
||||
|
||||
__std_ref 20.7.6.2.
|
||||
|
||||
__compat If the compiler does not support partial specialization of class-templates
|
||||
and rvalue references
|
||||
then this template will compile, but the member `type` will always be the same as
|
||||
type `T`.
|
||||
|
||||
__header ` #include <boost/type_traits/add_rvalue_reference.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
@ -46,5 +41,7 @@ __header ` #include <boost/type_traits/add_rvalue_reference.hpp>` or ` #include
|
||||
|
||||
]
|
||||
|
||||
__compat In the absence of rvalue-reference support this trait has no effect.
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -17,10 +17,6 @@ __type The same type as `T volatile` for all `T`.
|
||||
|
||||
__std_ref 3.9.3.
|
||||
|
||||
__compat If the compiler does not support partial specialization of class-templates
|
||||
then this template will compile, but the member `type` will always be the same as
|
||||
type `T` except where __transform_workaround have been applied.
|
||||
|
||||
__header ` #include <boost/type_traits/add_volatile.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
[table Examples
|
||||
@ -37,5 +33,7 @@ __header ` #include <boost/type_traits/add_volatile.hpp>` or ` #include <boost/t
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -11,83 +11,73 @@
|
||||
[section:common_type common_type]
|
||||
[/===================================================================]
|
||||
|
||||
[def __declval [@../../../utility/doc/html/declval.html declval]]
|
||||
|
||||
|
||||
__header ` #include <boost/type_traits/common_type.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
namespace boost {
|
||||
template <class ...T> struct __common_type;
|
||||
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
|
||||
`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>
|
||||
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, class U, class... V>
|
||||
struct common_type<T, U, V...> {
|
||||
typedef typename common_type<typename common_type<T, U>::type, V...>::type type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct common_type<> {
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct common_type<T> {
|
||||
typedef T type;
|
||||
typedef typename __decay<T>::type type;
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
struct common_type<T, U> {
|
||||
typedef decltype(__declval<bool>() ? __declval<T>() : __declval<U>()) type;
|
||||
typedef typename __decay<
|
||||
decltype( __declval<bool>()?
|
||||
__declval<typename __decay<T>::type>():
|
||||
__declval<typename __decay<U>::type>() )
|
||||
>::type 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.
|
||||
are desired among the `common_type` arguments.
|
||||
|
||||
Note that when the compiler does not support variadic templates (and the macro BOOST_NO_VARIADIC_TEMPLATES is defined)
|
||||
then the maximum number of template arguments is 3.
|
||||
Note that when the compiler does not support variadic templates (and the macro `BOOST_NO_CXX11_VARIADIC_TEMPLATES` is defined)
|
||||
then the maximum number of template arguments is 9.
|
||||
|
||||
|
||||
[h4 Configuration macros]
|
||||
|
||||
When the compiler does not support static assertions then the user can select the way static assertions are reported. Define
|
||||
|
||||
* BOOST_COMMON_TYPE_USES_STATIC_ASSERT: define it if you want to use Boost.StaticAssert
|
||||
* BOOST_COMMON_TYPE_USES_MPL_ASSERT: define it if you want to use Boost.MPL static assertions
|
||||
|
||||
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.
|
||||
|
||||
[h4 Tutorial]
|
||||
|
||||
In a nutshell, __common_type is a trait that takes 1 or more types, and returns a type which
|
||||
In a nutshell, `common_type` is a trait that takes 1 or more types, and returns a type which
|
||||
all of the types will convert to. The default definition demands this conversion be implicit.
|
||||
However the trait can be specialized for user-defined types which want to limit their inter-type conversions to explicit,
|
||||
and yet still want to interoperate with the __common_type facility.
|
||||
and yet still want to interoperate with the `common_type` facility.
|
||||
|
||||
[*Example:]
|
||||
|
||||
template <class T, class U>
|
||||
complex<typename __common_type<T, U>::type>
|
||||
complex<typename common_type<T, U>::type>
|
||||
operator+(complex<T>, complex<U>);
|
||||
|
||||
|
||||
In the above example, "mixed-mode" complex arithmetic is allowed. The return type is described by __common_type.
|
||||
In the above example, "mixed-mode" complex arithmetic is allowed. The return type is described by `common_type`.
|
||||
For example the resulting type of adding a `complex<float>` and `complex<double>` might be a `complex<double>`.
|
||||
|
||||
Here is how someone might produce a variadic comparison function:
|
||||
|
||||
template <class ...T>
|
||||
typename __common_type<T...>::type
|
||||
typename common_type<T...>::type
|
||||
min(T... t);
|
||||
|
||||
This is a very useful and broadly applicable utility.
|
||||
@ -97,17 +87,17 @@ This is a very useful and broadly applicable utility.
|
||||
Another choice for the author of the preceding operator could be
|
||||
|
||||
template <class T, class U>
|
||||
typename __common_type<complex<T>, complex<U> >::type
|
||||
typename common_type<complex<T>, complex<U> >::type
|
||||
operator+(complex<T>, complex<U>);
|
||||
|
||||
As the default definition of __common_type demands the conversion be implicit, we need to specialize the trait for complex types as follows.
|
||||
As the default definition of `common_type` demands the conversion be implicit, we need to specialize the trait for complex types as follows.
|
||||
|
||||
template <class T, class U>
|
||||
struct __common_type<complex<T>, complex<U> > {
|
||||
typedef complex< __common_type<T, U> > type;
|
||||
struct common_type<complex<T>, complex<U> > {
|
||||
typedef complex< common_type<T, U> > type;
|
||||
};
|
||||
|
||||
[h4 How important is the order of the common_type<> template arguments?]
|
||||
[h4 How important is the order of the `common_type<>` template arguments?]
|
||||
|
||||
The order of the template parameters is important.
|
||||
|
||||
@ -164,7 +154,7 @@ Clients wanting to ask `common_type<A, B, C>` in any order and get the same resu
|
||||
|
||||
This is needed as the specialization of `common_type<A, B>` is not be used implicitly for `common_type<B, A>`.
|
||||
|
||||
[h4 Can the common_type of two types be a third type?]
|
||||
[h4 Can the `common_type` of two types be a third type?]
|
||||
|
||||
Given the preceding example, one might expect `common_type<A,B>::type` to be `C` without any intervention from the user.
|
||||
But the default `common_type<>` implementation doesn't grant that. It is intended that clients who wish for `common_type<A, B>`
|
||||
@ -183,7 +173,7 @@ to be well defined to define it themselves:
|
||||
|
||||
Now this client can ask for `common_type<A, B>`.
|
||||
|
||||
[h4 How common_type behaves with pointers?]
|
||||
[h4 How does `common_type` behave with pointers?]
|
||||
|
||||
Consider
|
||||
|
||||
@ -209,17 +199,17 @@ But in the absence of a motivating use cases, we prefer not to add more than the
|
||||
|
||||
Of course the user can always make this specialization.
|
||||
|
||||
[h4 Can you explain the pros/cons of common_type against Boost.Typeof?]
|
||||
[h4 Can you explain the pros/cons of `common_type` against Boost.Typeof?]
|
||||
|
||||
Even if they appear to be close, `__common_type` and `typeof` have
|
||||
Even if they appear to be close, `common_type` and `typeof` have
|
||||
different purposes. You use `typeof` to get the type of an expression, while
|
||||
you use __common_type to set explicitly the type returned of a template
|
||||
function. Both are complementary, and indeed __common_type is equivalent to
|
||||
`decltype(__declval<bool>() ? __declval<T>() : __declval<U>())`
|
||||
you use `common_type` to set explicitly the type returned of a template
|
||||
function. Both are complementary, and indeed `common_type` is approximately equivalent to
|
||||
`decltype(__declval<bool>() ? __declval<T>() : __declval<U>())`.
|
||||
|
||||
__common_type is also similar to promote_args<class ...T> in boost/math/tools/promotion.hpp,
|
||||
though it is not exactly the same as promote_args either. __common_type<T1, T2>::type simply represents the result of some
|
||||
operation on T1 and T2, and defaults to the type obtained by putting T1 and T2 into a conditional statement.
|
||||
`common_type` is also similar to `promote_args<class ...T>` in `boost/math/tools/promotion.hpp`,
|
||||
though it is not exactly the same as `promote_args` either. `common_type<T1, T2>::type` simply represents the result of some
|
||||
operation on `T1` and `T2`, and defaults to the type obtained by putting `T1` and `T2` into a conditional statement.
|
||||
|
||||
It is meant to be customizable (via specialization) if this default is not appropriate.
|
||||
|
||||
|
@ -18,7 +18,5 @@ __header ` #include <boost/type_traits/conditional.hpp>` or ` #include <boost/ty
|
||||
|
||||
If B is true, the member typedef type shall equal T. If B is false, the member typedef type shall equal U.
|
||||
|
||||
This trait is really just an alias for `boost::mpl::if_c`.
|
||||
|
||||
[endsect]
|
||||
|
||||
|
39
doc/copy_cv.qbk
Normal file
39
doc/copy_cv.qbk
Normal file
@ -0,0 +1,39 @@
|
||||
[/
|
||||
Copyright 2015 Peter Dimov.
|
||||
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:copy_cv copy_cv]
|
||||
|
||||
template <class T, class U>
|
||||
struct copy_cv
|
||||
{
|
||||
typedef __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 Examples
|
||||
|
||||
[ [Expression] [Result Type]]
|
||||
|
||||
[[`copy_cv<int, void>::type`][`int`]]
|
||||
|
||||
[[`copy_cv<int const, void>::type`][`int const`]]
|
||||
|
||||
[[`copy_cv<int, void const>::type`][`int const`]]
|
||||
|
||||
[[`copy_cv<int volatile, void const>::type`][`int const volatile`]]
|
||||
|
||||
[[`copy_cv<int&, void const>::type`] [`int&`]]
|
||||
|
||||
[[`copy_cv<int*, void volatile>::type`] [`int* volatile`]]
|
||||
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
@ -36,5 +36,7 @@ __header ` #include <boost/type_traits/decay.hpp>` or ` #include <boost/type_tra
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
120
doc/declval.qbk
120
doc/declval.qbk
@ -1,115 +1,21 @@
|
||||
[/
|
||||
/ Copyright (c) 2008 Howard Hinnant
|
||||
/ Copyright (c) 2009-20012 Vicente J. Botet Escriba
|
||||
/
|
||||
/ 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)
|
||||
/]
|
||||
|
||||
[article Declval
|
||||
[quickbook 1.5]
|
||||
[authors [Hinnant, Howard]]
|
||||
[authors [Botet Escriba, Vicente J.]]
|
||||
[copyright 2008 Howard Hinnant]
|
||||
[copyright 2009-2012 Vicente J. Botet Escriba]
|
||||
[license
|
||||
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])
|
||||
]
|
||||
[/
|
||||
Copyright 2015 Peter Dimov.
|
||||
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 Overview]
|
||||
[/===============]
|
||||
[section:declval declval]
|
||||
|
||||
The motivation for `declval` was introduced in [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2958.html#Value N2958:
|
||||
Moving Swap Forward]. Here follows a rewording of this chapter.
|
||||
template <class T>
|
||||
typename add_rvalue_reference<T>::type declval() noexcept; // as unevaluated operand
|
||||
|
||||
With the provision of decltype, late-specified return types, and default template-arguments for function templates a
|
||||
new generation of SFINAE patterns will emerge to at least partially compensate the lack of concepts on the C++0x timescale.
|
||||
Using this technique, it is sometimes necessary to obtain an object of a known type in a non-using context, e.g. given the declaration
|
||||
__std_ref C++11 20.2.4 [declval].
|
||||
|
||||
template<class T>
|
||||
T&& declval(); // not used
|
||||
|
||||
as part of the function template declaration
|
||||
__header ` #include <boost/type_traits/declval.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
template<class To, class From>
|
||||
decltype(static_cast<To>(declval<From>())) convert(From&&);
|
||||
|
||||
or as part of a class template definition
|
||||
|
||||
template<class> class result_of;
|
||||
|
||||
template<class Fn, class... ArgTypes>
|
||||
struct result_of<Fn(ArgTypes...)>
|
||||
{
|
||||
typedef decltype(declval<Fn>()(declval<ArgTypes>()...)) type;
|
||||
};
|
||||
|
||||
The role of the function template declval() is a transformation of a type T into a value without using or evaluating this function.
|
||||
The name is supposed to direct the reader's attention to the fact that the expression `declval<T>()` is an lvalue if and only if
|
||||
T is an lvalue-reference, otherwise an rvalue. To extend the domain of this function we can do a bit better by changing its declaration to
|
||||
|
||||
template<class T>
|
||||
typename std::add_rvalue_reference<T>::type declval(); // not used
|
||||
|
||||
which ensures that we can also use cv void as template parameter. The careful reader might have noticed that `declval()`
|
||||
already exists under the name create() as part of the definition of the semantics of the type trait is_convertible in the C++0x standard.
|
||||
|
||||
The provision of a new library component that allows the production of values in unevaluated expressions is considered
|
||||
important to realize constrained templates in C++0x where concepts are not available.
|
||||
This extremely light-weight function is expected to be part of the daily tool-box of the C++0x programmer.
|
||||
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>() )`.
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
[/=================]
|
||||
[section:reference Reference ]
|
||||
[/=================]
|
||||
|
||||
`#include <boost/utility/declval.hpp>`
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <typename T>
|
||||
typename add_rvalue_reference<T>::type declval() noexcept; // as unevaluated operand
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
The library provides the function template declval to simplify the definition of expressions which occur as unevaluated operands.
|
||||
|
||||
template <typename T>
|
||||
typename add_rvalue_reference<T>::type declval();
|
||||
|
||||
[*Remarks:] If this function is used, the program is ill-formed.
|
||||
|
||||
[*Remarks:] The template parameter T of declval may be an incomplete type.
|
||||
|
||||
[*Example:]
|
||||
|
||||
template <class To, class From>
|
||||
decltype(static_cast<To>(declval<From>())) convert(From&&);
|
||||
|
||||
Declares a function template convert which only participates in overloading if the type From can be explicitly converted to type To.
|
||||
|
||||
[endsect]
|
||||
|
||||
[/===============]
|
||||
[section History]
|
||||
[/===============]
|
||||
|
||||
[heading boost 1.50]
|
||||
|
||||
Fixes:
|
||||
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6570 #6570] Adding noexcept to boost::declval.
|
||||
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -44,5 +44,7 @@ expression that evaluates to /0/: `boost::array` is a class type and [*not an ar
|
||||
|
||||
[:`extent<T>::value_type` is the type `std::size_t`.]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -33,5 +33,7 @@ __header ` #include <boost/type_traits/floating_point_promotion.hpp>` or ` #incl
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -52,5 +52,7 @@ type use __remove_pointer.]
|
||||
|
||||
]
|
||||
|
||||
[all_compilers]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -44,9 +44,7 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
[has_binary_operator_compat]
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_bit_and_assign.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_bit_and_assign<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -44,10 +46,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator&=` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_bit_or.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_bit_or<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -44,10 +46,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator|` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_bit_or_assign.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_bit_or_assign<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -44,10 +46,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator|=` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_bit_xor.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_bit_xor<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -44,10 +46,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator^` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_bit_xor_assign.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_bit_xor_assign<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -44,10 +46,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator^=` is public or not:
|
||||
|
@ -27,6 +27,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_complement.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_complement<Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -46,10 +48,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether prefix `operator~` is public or not:
|
||||
|
@ -27,6 +27,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_dereference.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_dereference<Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -49,10 +51,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether prefix `operator*` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_divides.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_divides<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -46,10 +48,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator/` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_divides_assign.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_divides_assign<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -46,10 +48,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator/=` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_equal_to.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_equal_to<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -46,10 +48,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator==` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_greater.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_greater<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -46,10 +48,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator>` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_greater_equal.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_greater_equal<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -46,10 +48,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator>=` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_left_shift.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_left_shift<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -47,10 +49,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator<<` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_left_shift_assign.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_left_shift_assign<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -44,10 +46,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator<<=` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_less.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_less<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -46,10 +48,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator<` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_less_equal.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_less_equal<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -46,10 +48,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator<=` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_logical_and.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_logical_and<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -45,10 +47,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator&&` is public or not:
|
||||
|
@ -27,6 +27,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_logical_not.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_logical_not<Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -45,10 +47,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether prefix `operator!` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_logical_or.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_logical_or<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -45,10 +47,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator||` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_minus.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_minus<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -46,10 +48,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator-` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_minus_assign.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_minus_assign<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -46,10 +48,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator-=` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_modulus.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_modulus<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -44,10 +46,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator%` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_modulus_assign.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_modulus_assign<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -44,10 +46,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator%=` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_multiplies.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_multiplies<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -46,10 +48,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator*` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_multiplies_assign.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_multiplies_assign<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -46,10 +48,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator*=` is public or not:
|
||||
|
@ -27,6 +27,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_negate.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_negate<Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -45,10 +47,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether prefix `operator-` is public or not:
|
||||
|
@ -12,9 +12,7 @@
|
||||
__inherit If T is a (possibly cv-qualified) type with an overloaded new-operator
|
||||
then inherits from __true_type, otherwise inherits from __false_type.
|
||||
|
||||
__compat Not usable with compilers that do not support "substitution failure is not an error"
|
||||
(in which case BOOST_NO_SFINAE will be defined), also known to be broken with
|
||||
the Borland/Codegear compiler.
|
||||
[has_binary_operator_compat] Also known to be broken with the Borland/Codegear compilers.
|
||||
|
||||
__std_ref 12.5.
|
||||
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_not_equal_to.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_not_equal_to<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -46,10 +48,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator!=` is public or not:
|
||||
|
@ -14,14 +14,11 @@ __inherit If T is a (possibly cv-qualified) type with a non-throwing assignment-
|
||||
then inherits from __true_type, otherwise inherits from __false_type. Type `T`
|
||||
must be a complete type.
|
||||
|
||||
__compat If the compiler does not support partial-specialization of class
|
||||
templates, then this template can not be used with function types.
|
||||
|
||||
Without some (as yet unspecified) help from the compiler,
|
||||
`has_nothrow_assign` will never report that a class or struct has a
|
||||
non-throwing assignment-operator; this is always safe, if possibly sub-optimal.
|
||||
Currently (May 2005) only Visual C++ 8 has the necessary compiler support to ensure that this
|
||||
trait "just works".
|
||||
__compat 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_assign.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
|
@ -19,16 +19,11 @@ must be a complete type.
|
||||
|
||||
These two traits are synonyms for each other.
|
||||
|
||||
__compat If the compiler does not support partial-specialization of class
|
||||
templates, then this template can not be used with function types.
|
||||
|
||||
Without some (unspecified) help from the compiler,
|
||||
`has_nothrow_constructor` will never report that a class or struct has a
|
||||
non-throwing default-constructor; this is always safe, if possibly sub-optimal.
|
||||
Currently (May 2011) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
|
||||
Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this
|
||||
trait "just works". You may also test to see if the necessary __intrinsics are available
|
||||
by checking to see if the macro `BOOST_HAS_NOTHROW_CONSTRUCTOR` is defined.
|
||||
__compat 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>`
|
||||
|
||||
|
@ -19,16 +19,11 @@ must be a complete type.
|
||||
|
||||
These two traits are synonyms for each other.
|
||||
|
||||
__compat If the compiler does not support partial-specialization of class
|
||||
templates, then this template can not be used with function types.
|
||||
|
||||
Without some (as yet unspecified) help from the compiler,
|
||||
`has_nothrow_copy` will never report that a class or struct has a
|
||||
non-throwing copy-constructor; this is always safe, if possibly sub-optimal.
|
||||
Currently (May 2011) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
|
||||
Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this
|
||||
trait "just works". You may also test to see if the necessary __intrinsics are available
|
||||
by checking to see if the macro `BOOST_HAS_NOTHROW_COPY` is defined.
|
||||
__compat 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_COPY) || (!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>`
|
||||
|
||||
|
29
doc/has_nothrow_destruct.qbk
Normal file
29
doc/has_nothrow_destruct.qbk
Normal file
@ -0,0 +1,29 @@
|
||||
[/
|
||||
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:has_nothrow_destruct has_nothrow_destructor]
|
||||
|
||||
template <class T>
|
||||
struct has_nothrow_destructor : public __tof {};
|
||||
|
||||
__inherit 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.
|
||||
|
||||
__compat 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 `throw(something)` specification.
|
||||
This is in line with the C++11 standard.
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_plus.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_plus<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -46,10 +48,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator+` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_plus_assign.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_plus_assign<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -46,10 +48,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator+=` is public or not:
|
||||
|
@ -27,6 +27,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_post_decrement.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_post_decrement<Lhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -47,10 +49,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether postfix `operator--` is public or not:
|
||||
|
@ -27,6 +27,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_post_increment.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_post_increment<Lhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -47,10 +49,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether postfix `operator++` is public or not:
|
||||
|
@ -27,6 +27,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_pre_decrement.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_pre_decrement<Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -47,10 +49,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether prefix `operator--` is public or not:
|
||||
|
@ -27,6 +27,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_pre_increment.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_pre_increment<Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -47,10 +49,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether prefix `operator++` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_right_shift.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_right_shift<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -47,10 +49,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator>>` is public or not:
|
||||
|
@ -28,6 +28,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_right_shift_assign.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_right_shift_assign<Lhs, Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -44,10 +46,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether binary `operator>>=` is public or not:
|
||||
|
@ -16,13 +16,12 @@ If a type has a trivial assignment-operator then the operator has the same effec
|
||||
as copying the bits of one object to the other:
|
||||
calls to the operator can be safely replaced with a call to `memcpy`.
|
||||
|
||||
__compat If the compiler does not support partial-specialization of class
|
||||
templates, then this template can not be used with function types.
|
||||
|
||||
Without some (as yet unspecified) help from the compiler,
|
||||
__compat Without some (as yet unspecified) help from the compiler,
|
||||
has_trivial_assign will never report that a user-defined class or struct has a
|
||||
trivial constructor; this is always safe, if possibly sub-optimal.
|
||||
Currently (May 2011) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
|
||||
trivial constructor; this is always safe, if possibly sub-optimal. In order to
|
||||
correctly handle deleted or private assignment operators, the compiler must also
|
||||
support C++11's `decltype`.
|
||||
Currently (May 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
|
||||
Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this
|
||||
trait "just works". You may also test to see if the necessary __intrinsics are available
|
||||
by checking to see if the macro `BOOST_HAS_TRIVIAL_ASSIGN` is defined.
|
||||
|
@ -24,13 +24,12 @@ to omit a call to a single trivial-constructor call is of no benefit whatsoever.
|
||||
However, if loops and/or exception handling code can also be omitted, then some
|
||||
benefit in terms of code size and speed can be obtained.
|
||||
|
||||
__compat If the compiler does not support partial-specialization of class
|
||||
templates, then this template can not be used with function types.
|
||||
|
||||
Without some (as yet unspecified) help from the compiler,
|
||||
__compat Without some (as yet unspecified) help from the compiler,
|
||||
has_trivial_constructor will never report that a user-defined class or struct has a
|
||||
trivial constructor; this is always safe, if possibly sub-optimal.
|
||||
Currently (May 2011) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
|
||||
In addition, in order to correctly handle private or deleted default-constructors then
|
||||
C++11's `deltype` is required.
|
||||
Currently (May 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
|
||||
Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this
|
||||
trait "just works". You may also test to see if the necessary __intrinsics are available
|
||||
by checking to see if the macro `BOOST_HAS_TRIVIAL_CONSTRUCTOR` is defined.
|
||||
|
@ -22,13 +22,12 @@ If a type has a trivial copy-constructor then the constructor has the same effec
|
||||
as copying the bits of one object to the other:
|
||||
calls to the constructor can be safely replaced with a call to `memcpy`.
|
||||
|
||||
__compat If the compiler does not support partial-specialization of class
|
||||
templates, then this template can not be used with function types.
|
||||
|
||||
Without some (as yet unspecified) help from the compiler,
|
||||
__compat Without some (as yet unspecified) help from the compiler,
|
||||
has_trivial_copy will never report that a user-defined class or struct has a
|
||||
trivial constructor; this is always safe, if possibly sub-optimal.
|
||||
Currently (May 2011) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
|
||||
In addition, in order to correctly handle deleted or private copy-constructors
|
||||
then C++11's `dectype` is required.
|
||||
Currently (May 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
|
||||
Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this
|
||||
trait "just works". You may also test to see if the necessary __intrinsics are available
|
||||
by checking to see if the macro `BOOST_HAS_TRIVIAL_COPY` is defined.
|
||||
|
@ -18,13 +18,12 @@ to omit a call to a single trivial-constructor call is of no benefit whatsoever.
|
||||
However, if loops and/or exception handling code can also be omitted, then some
|
||||
benefit in terms of code size and speed can be obtained.
|
||||
|
||||
__compat If the compiler does not support partial-specialization of class
|
||||
templates, then this template can not be used with function types.
|
||||
|
||||
Without some (as yet unspecified) help from the compiler,
|
||||
__compat Without some (as yet unspecified) help from the compiler,
|
||||
has_trivial_destructor will never report that a user-defined class or struct has a
|
||||
trivial destructor; this is always safe, if possibly sub-optimal.
|
||||
Currently (May 2011) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
|
||||
In addition, in order to correctly handle deleted or private destructors then
|
||||
support for C++11's `decltype` is required.
|
||||
Currently (June 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
|
||||
Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this
|
||||
trait "just works". You may also test to see if the necessary __intrinsics are available
|
||||
by checking to see if the macro `BOOST_HAS_TRIVIAL_DESTRUCTOR` is defined.
|
||||
|
@ -17,14 +17,14 @@ If a type has a trivial move assignment-operator then the operator has the same
|
||||
as copying the bits of one object to the other:
|
||||
calls to the operator can be safely replaced with a call to `memcpy`.
|
||||
|
||||
__compat If the compiler does not support partial-specialization of class
|
||||
templates, then this template can not be used with function types.
|
||||
|
||||
Without some (as yet unspecified) help from the compiler,
|
||||
__compat Without some (as yet unspecified) help from the compiler,
|
||||
has_trivial_move_assign will never report that a user-defined class or struct has a
|
||||
trivial constructor; this is always safe, if possibly sub-optimal.
|
||||
Currently (February 2013) compilers have no necessary __intrinsics to ensure that this
|
||||
trait "just works". You may also test to see if the necessary __intrinsics are available
|
||||
trivial move assign; this is always safe, if possibly sub-optimal.
|
||||
In addition, in order to correctly handle private or deleted move assignment
|
||||
operators then c++11's `decltype` is required.
|
||||
Currently (June 2015) compilers that have the necessary __intrinsics to ensure that this
|
||||
trait "just works" include Clang, GCC-5.1 and MSVC-12.0.
|
||||
You may also test to see if the necessary __intrinsics are available
|
||||
by checking to see if the macro `BOOST_HAS_TRIVIAL_MOVE_ASSIGN` is defined.
|
||||
|
||||
|
||||
|
@ -18,14 +18,14 @@ If a type has a trivial move-constructor then the constructor has the same effec
|
||||
as copying the bits of one object to the other:
|
||||
calls to the constructor can be safely replaced with a call to `memcpy`.
|
||||
|
||||
__compat If the compiler does not support partial-specialization of class
|
||||
templates, then this template can not be used with function types.
|
||||
|
||||
Without some (as yet unspecified) help from the compiler,
|
||||
__compat Without some (as yet unspecified) help from the compiler,
|
||||
has_trivial_move_constructor will never report that a user-defined class or struct has a
|
||||
trivial constructor; this is always safe, if possibly sub-optimal.
|
||||
Currently (February 2013) compilers have no necessary __intrinsics to ensure that this
|
||||
trait "just works". You may also test to see if the necessary __intrinsics are available
|
||||
In addition C++11's `decltype` is required to correctly support deleted or private
|
||||
move constructors.
|
||||
Currently (June 2015) compilers that have the necessary __intrinsics to ensure that this
|
||||
trait "just works" include Clang, GCC-5.1, and MSVC-12.0.
|
||||
You may also test to see if the necessary __intrinsics are available
|
||||
by checking to see if the macro `BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR` is defined.
|
||||
|
||||
|
||||
|
@ -27,6 +27,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_unary_minus.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_unary_minus<Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -45,10 +47,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether prefix `operator-` is public or not:
|
||||
|
@ -27,6 +27,8 @@ If `Ret=void`, the return type is checked to be exactly `void`.
|
||||
|
||||
__header `#include <boost/type_traits/has_unary_plus.hpp>` or `#include <boost/type_traits/has_operator.hpp>` or `#include <boost/type_traits.hpp>`
|
||||
|
||||
[has_binary_operator_compat]
|
||||
|
||||
__examples
|
||||
|
||||
[:`has_unary_plus<Rhs, Ret>::value_type` is the type `bool`.]
|
||||
@ -45,10 +47,6 @@ __examples
|
||||
|
||||
[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits]
|
||||
|
||||
[*Limitation:]
|
||||
|
||||
* Requires a compiler with working SFINAE.
|
||||
|
||||
[*Known issues:]
|
||||
|
||||
* This trait cannot detect whether prefix `operator+` is public or not:
|
||||
|
@ -12,14 +12,13 @@
|
||||
__inherit If T is a (possibly cv-qualified) type with a virtual destructor
|
||||
then inherits from __true_type, otherwise inherits from __false_type.
|
||||
|
||||
__compat This trait is provided for completeness, since it's part of the
|
||||
Technical Report on C++ Library Extensions. However, there is currently no
|
||||
way to portably implement this trait. The default version provided
|
||||
__compat There is currently no
|
||||
way to portably implement this trait: the default version
|
||||
always inherits from __false_type, and has to be explicitly specialized for
|
||||
types with virtual destructors unless the compiler used has compiler __intrinsics
|
||||
that enable the trait to do the right thing:
|
||||
Currently (May 2011) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
|
||||
Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this
|
||||
Currently (June 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
|
||||
Intel-11.0, plus Codegear and Clang have the necessary compiler __intrinsics to ensure that this
|
||||
trait "just works". You may also test to see if the necessary __intrinsics are available
|
||||
by checking to see if the macro `BOOST_HAS_VIRTUAL_DESTRUCTOR` is defined.
|
||||
|
||||
|
@ -7,6 +7,13 @@
|
||||
|
||||
[section:history History]
|
||||
|
||||
[h4 Boost 1.60.0 ???]
|
||||
|
||||
* Refactored traits to depend only on Boost.Config. Greatly simplified code to improve readability and remove workarounds for old compilers no longer supported.
|
||||
* Fix __decay to follow C++11 semantics, see [@https://svn.boost.org/trac/boost/ticket/7760 #7760].
|
||||
* Added a number of new traits __is_assignable, __is_default_constructible, __is_constructible and __is_destructible required to fix bugs in a number of other traits,
|
||||
see for example [@https://svn.boost.org/trac/boost/ticket/7760 #11324].
|
||||
|
||||
[h4 Boost 1.58.0]
|
||||
|
||||
* Fixed issue with CUDA on Clang compiler see [@https://svn.boost.org/trac/boost/ticket/10694 #10694].
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Background and Tutorial</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="prev" href="intro.html" title="Introduction">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Type Traits by Category</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="prev" href="background.html" title="Background and Tutorial">
|
||||
@ -26,7 +26,7 @@
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_typetraits.category"></a><a class="link" href="category.html" title="Type Traits by Category">Type Traits by Category</a>
|
||||
</h2></div></div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="category/value_traits.html">Type Traits that
|
||||
Describe the Properties of a Type</a></span></dt>
|
||||
<dd><dl>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Synthesizing Types with Specific Alignments</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../category.html" title="Type Traits by Category">
|
||||
<link rel="prev" href="transform.html" title="Type Traits that Transform One Type to Another">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Decomposing Function Types</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../category.html" title="Type Traits by Category">
|
||||
<link rel="prev" href="alignment.html" title="Synthesizing Types with Specific Alignments">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Type Traits that Transform One Type to Another</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../category.html" title="Type Traits by Category">
|
||||
<link rel="prev" href="value_traits/operators.html" title="Operator Type Traits">
|
||||
@ -63,6 +63,9 @@
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span><span class="special">...</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../reference/common_type.html" title="common_type">common_type</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../reference/copy_cv.html" title="copy_cv">copy_cv</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../reference/decay.html" title="decay">decay</a><span class="special">;</span>
|
||||
|
||||
@ -101,63 +104,10 @@
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../reference/remove_volatile.html" title="remove_volatile">remove_volatile</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../reference/type_identity.html" title="type_identity">type_identity</a><span class="special">;</span>
|
||||
</pre>
|
||||
<h5>
|
||||
<a name="boost_typetraits.category.transform.h0"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.category.transform.broken_compiler_workarounds_"></a></span><a class="link" href="transform.html#boost_typetraits.category.transform.broken_compiler_workarounds_">Broken
|
||||
Compiler Workarounds:</a>
|
||||
</h5>
|
||||
<p>
|
||||
For all of these templates support for partial specialization of class templates
|
||||
is required to correctly implement the transformation. On the other hand,
|
||||
practice shows that many of the templates from this category are very useful,
|
||||
and often essential for implementing some generic libraries. Lack of these
|
||||
templates is often one of the major limiting factors in porting those libraries
|
||||
to compilers that do not yet support this language feature. As some of these
|
||||
compilers are going to be around for a while, and at least one of them is
|
||||
very wide-spread, it was decided that the library should provide workarounds
|
||||
where possible.
|
||||
</p>
|
||||
<p>
|
||||
The basic idea behind the workaround is to manually define full specializations
|
||||
of all type transformation templates for all fundamental types, and all their
|
||||
1st and 2nd rank cv-[un]qualified derivative pointer types, and to provide
|
||||
a user-level macro that will define all the explicit specializations needed
|
||||
for any user-defined type T.
|
||||
</p>
|
||||
<p>
|
||||
The first part guarantees the successful compilation of something like this:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span><span class="identifier">is_same</span><span class="special"><</span><span class="keyword">char</span><span class="special">,</span> <span class="identifier">remove_reference</span><span class="special"><</span><span class="keyword">char</span><span class="special">&>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">value</span><span class="special">));</span>
|
||||
<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span><span class="identifier">is_same</span><span class="special"><</span><span class="keyword">char</span> <span class="keyword">const</span><span class="special">,</span> <span class="identifier">remove_reference</span><span class="special"><</span><span class="keyword">char</span> <span class="keyword">const</span><span class="special">&>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">value</span><span class="special">));</span>
|
||||
<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span><span class="identifier">is_same</span><span class="special"><</span><span class="keyword">char</span> <span class="keyword">volatile</span><span class="special">,</span> <span class="identifier">remove_reference</span><span class="special"><</span><span class="keyword">char</span> <span class="keyword">volatile</span><span class="special">&>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">value</span><span class="special">));</span>
|
||||
<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span><span class="identifier">is_same</span><span class="special"><</span><span class="keyword">char</span> <span class="keyword">const</span> <span class="keyword">volatile</span><span class="special">,</span> <span class="identifier">remove_reference</span><span class="special"><</span><span class="keyword">char</span> <span class="keyword">const</span> <span class="keyword">volatile</span><span class="special">&>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">value</span><span class="special">));</span>
|
||||
<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span><span class="identifier">is_same</span><span class="special"><</span><span class="keyword">char</span><span class="special">*,</span> <span class="identifier">remove_reference</span><span class="special"><</span><span class="keyword">char</span><span class="special">*&>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">value</span><span class="special">));</span>
|
||||
<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span><span class="identifier">is_same</span><span class="special"><</span><span class="keyword">char</span> <span class="keyword">const</span><span class="special">*,</span> <span class="identifier">remove_reference</span><span class="special"><</span><span class="keyword">char</span> <span class="keyword">const</span><span class="special">*&>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">value</span><span class="special">));</span>
|
||||
<span class="special">...</span>
|
||||
<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span><span class="identifier">is_same</span><span class="special"><</span><span class="keyword">char</span> <span class="keyword">const</span> <span class="keyword">volatile</span><span class="special">*</span> <span class="keyword">const</span> <span class="keyword">volatile</span><span class="special">*</span> <span class="keyword">const</span> <span class="keyword">volatile</span><span class="special">,</span> <span class="identifier">remove_reference</span><span class="special"><</span><span class="keyword">char</span> <span class="keyword">const</span> <span class="keyword">volatile</span><span class="special">*</span> <span class="keyword">const</span> <span class="keyword">volatile</span><span class="special">*</span> <span class="keyword">const</span> <span class="keyword">volatile</span><span class="special">&>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">value</span><span class="special">));</span>
|
||||
</pre>
|
||||
<p>
|
||||
and the second part provides the library's users with a mechanism to make
|
||||
the above code work not only for <code class="computeroutput"><span class="keyword">char</span></code>,
|
||||
<code class="computeroutput"><span class="keyword">int</span></code> or other built-in type,
|
||||
but for their own types as well:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">myspace</span><span class="special">{</span>
|
||||
<span class="keyword">struct</span> <span class="identifier">MyClass</span> <span class="special">{};</span>
|
||||
<span class="special">}</span>
|
||||
<span class="comment">// declare this at global scope:</span>
|
||||
<span class="identifier">BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</span><span class="special">(</span><span class="identifier">myspace</span><span class="special">::</span><span class="identifier">MyClass</span><span class="special">)</span>
|
||||
<span class="comment">// transformations on myspace::MyClass now work:</span>
|
||||
<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span><span class="identifier">is_same</span><span class="special"><</span><span class="identifier">myspace</span><span class="special">::</span><span class="identifier">MyClass</span><span class="special">,</span> <span class="identifier">remove_reference</span><span class="special"><</span><span class="identifier">myspace</span><span class="special">::</span><span class="identifier">MyClass</span><span class="special">&>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">value</span><span class="special">));</span>
|
||||
<span class="identifier">BOOST_STATIC_ASSERT</span><span class="special">((</span><span class="identifier">is_same</span><span class="special"><</span><span class="identifier">myspace</span><span class="special">::</span><span class="identifier">MyClass</span><span class="special">,</span> <span class="identifier">remove_const</span><span class="special"><</span><span class="identifier">myspace</span><span class="special">::</span><span class="identifier">MyClass</span> <span class="keyword">const</span><span class="special">>::</span><span class="identifier">type</span><span class="special">>::</span><span class="identifier">value</span><span class="special">));</span>
|
||||
<span class="comment">// etc.</span>
|
||||
</pre>
|
||||
<p>
|
||||
Note that the macro BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION evaluates
|
||||
to nothing on those compilers that <span class="bold"><strong>do</strong></span> support
|
||||
partial specialization.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Type Traits that Describe the Properties of a Type</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../category.html" title="Type Traits by Category">
|
||||
<link rel="prev" href="../category.html" title="Type Traits by Category">
|
||||
@ -27,7 +27,7 @@
|
||||
<a name="boost_typetraits.category.value_traits"></a><a class="link" href="value_traits.html" title="Type Traits that Describe the Properties of a Type">Type Traits that
|
||||
Describe the Properties of a Type</a>
|
||||
</h3></div></div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="value_traits/primary.html">Categorizing
|
||||
a Type</a></span></dt>
|
||||
<dt><span class="section"><a href="value_traits/properties.html">General
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Operator Type Traits</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../value_traits.html" title="Type Traits that Describe the Properties of a Type">
|
||||
<link rel="prev" href="relate.html" title="Relationships Between Two Types">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Categorizing a Type</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../value_traits.html" title="Type Traits that Describe the Properties of a Type">
|
||||
<link rel="prev" href="../value_traits.html" title="Type Traits that Describe the Properties of a Type">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>General Type Properties</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../value_traits.html" title="Type Traits that Describe the Properties of a Type">
|
||||
<link rel="prev" href="primary.html" title="Categorizing a Type">
|
||||
@ -54,6 +54,9 @@
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/has_nothrow_copy.html" title="has_nothrow_copy">has_nothrow_copy_constructor</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/has_nothrow_destruct.html" title="has_nothrow_destructor">has_nothrow_destructor</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/has_trivial_assign.html" title="has_trivial_assign">has_trivial_assign</a><span class="special">;</span>
|
||||
|
||||
@ -78,12 +81,33 @@
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_abstract.html" title="is_abstract">is_abstract</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_assignable.html" title="is_assignable">is_assignable</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_copy_constructible.html" title="is_copy_constructible">is_copy_constructible</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_copy_assignable.html" title="is_copy_assignable">is_copy_assignable</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span><span class="special">...</span> <span class="identifier">Args</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_constructible.html" title="is_constructible">is_constructible</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_default_constructible.html" title="is_default_constructible">is_default_constructible</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_destructible.html" title="is_destructible">is_destructible</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_const.html" title="is_const">is_const</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_empty.html" title="is_empty">is_empty</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_final.html" title="is_final">is_final</a><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="../../reference/is_stateless.html" title="is_stateless">is_stateless</a><span class="special">;</span>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Relationships Between Two Types</title>
|
||||
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../value_traits.html" title="Type Traits that Describe the Properties of a Type">
|
||||
<link rel="prev" href="properties.html" title="General Type Properties">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Credits</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="prev" href="history.html" title="History">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Examples</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="prev" href="mpl.html" title="MPL Interoperability">
|
||||
@ -26,7 +26,7 @@
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_typetraits.examples"></a><a class="link" href="examples.html" title="Examples">Examples</a>
|
||||
</h2></div></div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="examples/copy.html">An Optimized Version
|
||||
of std::copy</a></span></dt>
|
||||
<dt><span class="section"><a href="examples/fill.html">An Optimised Version
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>An Optimized Version of std::copy</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../examples.html" title="Examples">
|
||||
<link rel="prev" href="../examples.html" title="Examples">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>An Example that Omits Destructor Calls For Types with Trivial Destructors</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../examples.html" title="Examples">
|
||||
<link rel="prev" href="fill.html" title="An Optimised Version of std::fill">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>An Optimised Version of std::fill</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../examples.html" title="Examples">
|
||||
<link rel="prev" href="copy.html" title="An Optimized Version of std::copy">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Improving std::min with common_type</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../examples.html" title="Examples">
|
||||
<link rel="prev" href="to_double.html" title="Convert Numeric Types and Enums to double">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>An improved Version of std::iter_swap</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../examples.html" title="Examples">
|
||||
<link rel="prev" href="destruct.html" title="An Example that Omits Destructor Calls For Types with Trivial Destructors">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Convert Numeric Types and Enums to double</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../examples.html" title="Examples">
|
||||
<link rel="prev" href="iter.html" title="An improved Version of std::iter_swap">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>History</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="prev" href="reference/type_with_alignment.html" title="type_with_alignment">
|
||||
@ -28,6 +28,29 @@
|
||||
</h2></div></div></div>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h0"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_60_0____"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_60_0____">Boost
|
||||
1.60.0 ???</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
Refactored traits to depend only on Boost.Config. Greatly simplified code
|
||||
to improve readability and remove workarounds for old compilers no longer
|
||||
supported.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Fix <a class="link" href="reference/decay.html" title="decay">decay</a> to follow
|
||||
C++11 semantics, see <a href="https://svn.boost.org/trac/boost/ticket/7760" target="_top">#7760</a>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Added a number of new traits <a class="link" href="reference/is_assignable.html" title="is_assignable">is_assignable</a>,
|
||||
<a class="link" href="reference/is_default_constructible.html" title="is_default_constructible">is_default_constructible</a>,
|
||||
<a class="link" href="reference/is_constructible.html" title="is_constructible">is_constructible</a>
|
||||
and <a class="link" href="reference/is_destructible.html" title="is_destructible">is_destructible</a>
|
||||
required to fix bugs in a number of other traits, see for example <a href="https://svn.boost.org/trac/boost/ticket/7760" target="_top">#11324</a>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h1"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_58_0"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_58_0">Boost
|
||||
1.58.0</a>
|
||||
</h5>
|
||||
@ -42,7 +65,7 @@
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h1"></a>
|
||||
<a name="boost_typetraits.history.h2"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_57_0"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_57_0">Boost
|
||||
1.57.0</a>
|
||||
</h5>
|
||||
@ -56,7 +79,7 @@
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h2"></a>
|
||||
<a name="boost_typetraits.history.h3"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_56_0"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_56_0">Boost
|
||||
1.56.0</a>
|
||||
</h5>
|
||||
@ -65,7 +88,7 @@
|
||||
<a href="https://svn.boost.org/trac/boost/ticket/9474" target="_top">#9474</a>.
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h3"></a>
|
||||
<a name="boost_typetraits.history.h4"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_55_0"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_55_0">Boost
|
||||
1.55.0</a>
|
||||
</h5>
|
||||
@ -73,7 +96,7 @@
|
||||
Added new trait <a class="link" href="reference/is_copy_constructible.html" title="is_copy_constructible">is_copy_constructible</a>.
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h4"></a>
|
||||
<a name="boost_typetraits.history.h5"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_54_0"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_54_0">Boost
|
||||
1.54.0</a>
|
||||
</h5>
|
||||
@ -84,7 +107,7 @@
|
||||
<a class="link" href="reference/has_trivial_move_constructor.html" title="has_trivial_move_constructor">has_trivial_move_constructor</a>.
|
||||
</li></ul></div>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h5"></a>
|
||||
<a name="boost_typetraits.history.h6"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_47_0"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_47_0">Boost
|
||||
1.47.0</a>
|
||||
</h5>
|
||||
@ -99,7 +122,7 @@
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h6"></a>
|
||||
<a name="boost_typetraits.history.h7"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_45_0"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_45_0">Boost
|
||||
1.45.0</a>
|
||||
</h5>
|
||||
@ -116,7 +139,7 @@
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h7"></a>
|
||||
<a name="boost_typetraits.history.h8"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_44_0"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_44_0">Boost
|
||||
1.44.0</a>
|
||||
</h5>
|
||||
@ -133,7 +156,7 @@
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="boost_typetraits.history.h8"></a>
|
||||
<a name="boost_typetraits.history.h9"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.history.boost_1_42_0"></a></span><a class="link" href="history.html#boost_typetraits.history.boost_1_42_0">Boost
|
||||
1.42.0</a>
|
||||
</h5>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Support for Compiler Intrinsics</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="prev" href="user_defined.html" title="User Defined Specializations">
|
||||
@ -47,6 +47,12 @@
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/is_pod.html" title="is_pod">is_pod</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/is_nothrow_move_assignable.html" title="is_nothrow_move_assignable">is_nothrow_move_assignable</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/is_nothrow_move_constructible.html" title="is_nothrow_move_constructible">is_nothrow_move_constructible</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/has_trivial_constructor.html" title="has_trivial_constructor">has_trivial_constructor</a>
|
||||
</li>
|
||||
@ -90,6 +96,9 @@
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/is_polymorphic.html" title="is_polymorphic">is_polymorphic</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="reference/is_virtual_base_of.html" title="is_virtual_base_of">is_virtual_base_of</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
The following traits classes are dependent on one or more of the above:
|
||||
@ -117,197 +126,17 @@
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
BOOST_IS_UNION(T)
|
||||
BOOST_ALIGNMENT_OF(T)
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Should evaluate to true if T is a union type
|
||||
Should evaluate to the alignment requirements of type T
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_POD(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T is a POD type
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_EMPTY(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T is an empty struct or union
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if the default constructor for T is trivial
|
||||
(i.e. has no effect)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_COPY(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T has a trivial copy constructor (and
|
||||
can therefore be replaced by a call to memcpy)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T has a trivial move constructor (and
|
||||
can therefore be replaced by a call to memcpy)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_ASSIGN(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T has a trivial assignment operator (and
|
||||
can therefore be replaced by a call to memcpy)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T has a trivial move assignment operator
|
||||
(and can therefore be replaced by a call to memcpy)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_DESTRUCTOR(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T has a trivial destructor (i.e. ~T()
|
||||
has no effect)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_NOTHROW_CONSTRUCTOR(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if <code class="computeroutput"><span class="identifier">T</span>
|
||||
<span class="identifier">x</span><span class="special">;</span></code>
|
||||
can not throw
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_NOTHROW_COPY(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if <code class="computeroutput"><span class="identifier">T</span><span class="special">(</span><span class="identifier">t</span><span class="special">)</span></code> can not throw
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_NOTHROW_ASSIGN(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if <code class="computeroutput"><span class="identifier">T</span>
|
||||
<span class="identifier">t</span><span class="special">,</span>
|
||||
<span class="identifier">u</span><span class="special">;</span>
|
||||
<span class="identifier">t</span> <span class="special">=</span>
|
||||
<span class="identifier">u</span></code> can not throw
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_VIRTUAL_DESTRUCTOR(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true T has a virtual destructor
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_NOTHROW_MOVE_ASSIGN(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true T has a non-throwing move assign operator.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_NOTHROW_MOVE_CONSTRUCT(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true T has a non-throwing move constructor.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_ABSTRACT(T)
|
||||
@ -356,6 +185,18 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_EMPTY(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T is an empty struct or union
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_ENUM(T)
|
||||
@ -368,6 +209,43 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_FINAL(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T is a class type declared with the final
|
||||
specifier
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_NOTHROW_MOVE_ASSIGN(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true T has a non-throwing move assign operator.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_NOTHROW_MOVE_CONSTRUCT(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true T has a non-throwing move constructor.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_POLYMORPHIC(T)
|
||||
@ -382,25 +260,156 @@
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_ALIGNMENT_OF(T)
|
||||
BOOST_IS_POD(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to the alignment requirements of type T
|
||||
Should evaluate to true if T is a POD type
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_IS_FINAL(T)
|
||||
BOOST_IS_UNION(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T is a class type declared with the final
|
||||
specifier
|
||||
Should evaluate to true if T is a union type
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_NOTHROW_ASSIGN(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if <code class="computeroutput"><span class="identifier">T</span>
|
||||
<span class="identifier">t</span><span class="special">,</span>
|
||||
<span class="identifier">u</span><span class="special">;</span>
|
||||
<span class="identifier">t</span> <span class="special">=</span>
|
||||
<span class="identifier">u</span></code> can not throw
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_NOTHROW_CONSTRUCTOR(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if <code class="computeroutput"><span class="identifier">T</span>
|
||||
<span class="identifier">x</span><span class="special">;</span></code>
|
||||
can not throw
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_NOTHROW_COPY(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if <code class="computeroutput"><span class="identifier">T</span><span class="special">(</span><span class="identifier">t</span><span class="special">)</span></code> can not throw
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_ASSIGN(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T has a trivial assignment operator (and
|
||||
can therefore be replaced by a call to memcpy)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if the default constructor for T is trivial
|
||||
(i.e. has no effect)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_COPY(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T has a trivial copy constructor (and
|
||||
can therefore be replaced by a call to memcpy)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_DESTRUCTOR(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T has a trivial destructor (i.e. ~T()
|
||||
has no effect)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T has a trivial move constructor (and
|
||||
can therefore be replaced by a call to memcpy)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_TRIVIAL_MOVE_ASSIGN(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true if T has a trivial move assignment operator
|
||||
(and can therefore be replaced by a call to memcpy)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
BOOST_HAS_VIRTUAL_DESTRUCTOR(T)
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Should evaluate to true T has a virtual destructor
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Introduction</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="prev" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>MPL Interoperability</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="prev" href="intrinsics.html" title="Support for Compiler Intrinsics">
|
||||
@ -29,18 +29,15 @@
|
||||
<p>
|
||||
All the value based traits in this library conform to MPL's requirements for
|
||||
an <a href="../../../../../libs/mpl/doc/refmanual/integral-constant.html" target="_top">Integral
|
||||
Constant type</a>: that includes a number of rather intrusive workarounds
|
||||
for broken compilers.
|
||||
Constant type</a>.
|
||||
</p>
|
||||
<p>
|
||||
Purely as an implementation detail, this means that <code class="computeroutput"><a class="link" href="reference/integral_constant.html" title="integral_constant">true_type</a></code>
|
||||
inherits from <a href="../../../../../libs/mpl/doc/refmanual/bool.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span></code></a>,
|
||||
<code class="computeroutput"><a class="link" href="reference/integral_constant.html" title="integral_constant">false_type</a></code>
|
||||
inherits from <a href="../../../../../libs/mpl/doc/refmanual/bool.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">false_</span></code></a>,
|
||||
and <code class="computeroutput"><a class="link" href="reference/integral_constant.html" title="integral_constant">integral_constant</a><span class="special"><</span><span class="identifier">T</span><span class="special">,</span>
|
||||
<span class="identifier">v</span><span class="special">></span></code>
|
||||
inherits from <a href="../../../../../libs/mpl/doc/refmanual/integral-c.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">integral_c</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span><span class="identifier">v</span><span class="special">></span></code></a>
|
||||
(provided <code class="computeroutput"><span class="identifier">T</span></code> is not <code class="computeroutput"><span class="keyword">bool</span></code>)
|
||||
Please note that these types no longer inherit from <code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span></code> or
|
||||
<code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">false_</span></code> etc, and the library will no longer
|
||||
implicitly include any MPL header. However there is an implicit conversion
|
||||
from <code class="computeroutput"><span class="identifier">integral_constant</span></code> to the
|
||||
corresponding MPL types, therefore tag-dispatching that uses MPL types in function
|
||||
overloads will still work as before.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Alphabetical Reference</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="prev" href="examples/improved_min.html" title="Improving std::min with common_type">
|
||||
@ -26,7 +26,7 @@
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_typetraits.reference"></a><a class="link" href="reference.html" title="Alphabetical Reference">Alphabetical Reference</a>
|
||||
</h2></div></div></div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="reference/add_const.html">add_const</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/add_cv.html">add_cv</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/add_lvalue_reference.html">add_lvalue_reference</a></span></dt>
|
||||
@ -38,7 +38,9 @@
|
||||
<dt><span class="section"><a href="reference/alignment_of.html">alignment_of</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/conditional.html">conditional</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/common_type.html">common_type</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/copy_cv.html">copy_cv</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/decay.html">decay</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/declval.html">declval</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/extent.html">extent</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/floating_point_promotion.html">floating_point_promotion</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/function_traits.html">function_traits</a></span></dt>
|
||||
@ -74,6 +76,7 @@
|
||||
<dt><span class="section"><a href="reference/has_nothrow_assign.html">has_nothrow_assign</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_nothrow_constructor.html">has_nothrow_constructor</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_nothrow_copy.html">has_nothrow_copy</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_nothrow_destruct.html">has_nothrow_destructor</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_nothrow_cp_cons.html">has_nothrow_copy_constructor</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_no_throw_def_cons.html">has_nothrow_default_constructor</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/has_plus.html">has_plus</a></span></dt>
|
||||
@ -100,14 +103,18 @@
|
||||
<dt><span class="section"><a href="reference/is_abstract.html">is_abstract</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_arithmetic.html">is_arithmetic</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_array.html">is_array</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_assignable.html">is_assignable</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_base_of.html">is_base_of</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_class.html">is_class</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_complex.html">is_complex</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_compound.html">is_compound</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_const.html">is_const</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_constructible.html">is_constructible</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_convertible.html">is_convertible</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_copy_constructible.html">is_copy_constructible</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_copy_assignable.html">is_copy_assignable</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_copy_constructible.html">is_copy_constructible</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_default_constructible.html">is_default_constructible</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_destructible.html">is_destructible</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_empty.html">is_empty</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_enum.html">is_enum</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/is_final.html">is_final</a></span></dt>
|
||||
@ -147,6 +154,7 @@
|
||||
<dt><span class="section"><a href="reference/remove_pointer.html">remove_pointer</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/remove_reference.html">remove_reference</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/remove_volatile.html">remove_volatile</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/type_identity.html">type_identity</a></span></dt>
|
||||
<dt><span class="section"><a href="reference/type_with_alignment.html">type_with_alignment</a></span></dt>
|
||||
</dl></div>
|
||||
</div>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>add_const</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="../reference.html" title="Alphabetical Reference">
|
||||
@ -39,14 +39,6 @@
|
||||
<p>
|
||||
<span class="bold"><strong>C++ Standard Reference:</strong></span> 3.9.3.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> If the compiler
|
||||
does not support partial specialization of class-templates then this template
|
||||
will compile, but the member <code class="computeroutput"><span class="identifier">type</span></code>
|
||||
will always be the same as type <code class="computeroutput"><span class="identifier">T</span></code>
|
||||
except where <a class="link" href="../category/transform.html#boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
|
||||
workarounds</a> have been applied.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Header:</strong></span> <code class="computeroutput"> <span class="preprocessor">#include</span>
|
||||
<span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">add_const</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
@ -124,7 +116,10 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
<br class="table-break"><p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> All current compilers
|
||||
are supported by this trait.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>add_cv</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="add_const.html" title="add_const">
|
||||
@ -40,14 +40,6 @@
|
||||
<p>
|
||||
<span class="bold"><strong>C++ Standard Reference:</strong></span> 3.9.3.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> If the compiler
|
||||
does not support partial specialization of class-templates then this template
|
||||
will compile, but the member <code class="computeroutput"><span class="identifier">type</span></code>
|
||||
will always be the same as type <code class="computeroutput"><span class="identifier">T</span></code>
|
||||
except where <a class="link" href="../category/transform.html#boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
|
||||
workarounds</a> have been applied.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Header:</strong></span> <code class="computeroutput"> <span class="preprocessor">#include</span>
|
||||
<span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">add_cv</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
@ -127,7 +119,10 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
<br class="table-break"><p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> All current compilers
|
||||
are supported by this trait.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>add_lvalue_reference</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="add_cv.html" title="add_cv">
|
||||
@ -44,14 +44,6 @@
|
||||
<p>
|
||||
<span class="bold"><strong>C++ Standard Reference:</strong></span> 20.7.6.2.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> If the compiler
|
||||
does not support partial specialization of class-templates then this template
|
||||
will compile, but the member <code class="computeroutput"><span class="identifier">type</span></code>
|
||||
will always be the same as type <code class="computeroutput"><span class="identifier">T</span></code>
|
||||
except where <a class="link" href="../category/transform.html#boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
|
||||
workarounds</a> have been applied.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Header:</strong></span> <code class="computeroutput"> <span class="preprocessor">#include</span>
|
||||
<span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">add_lvalue_reference</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
@ -153,7 +145,10 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
<br class="table-break"><p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> All current compilers
|
||||
are supported by this trait.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>add_pointer</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="add_lvalue_reference.html" title="add_lvalue_reference">
|
||||
@ -36,20 +36,12 @@
|
||||
<span class="bold"><strong>type:</strong></span> The same type as <code class="computeroutput"><span class="identifier">remove_reference</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">type</span><span class="special">*</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
The rationale for this template is that it produces the same type as <code class="computeroutput"><span class="identifier">TYPEOF</span><span class="special">(&</span><span class="identifier">t</span><span class="special">)</span></code>, where
|
||||
The rationale for this template is that it produces the same type as <code class="computeroutput"><span class="keyword">decltype</span><span class="special">(&</span><span class="identifier">t</span><span class="special">)</span></code>, where
|
||||
<code class="computeroutput"><span class="identifier">t</span></code> is an object of type <code class="computeroutput"><span class="identifier">T</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>C++ Standard Reference:</strong></span> 8.3.1.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> If the compiler
|
||||
does not support partial specialization of class-templates then this template
|
||||
will compile, but the member <code class="computeroutput"><span class="identifier">type</span></code>
|
||||
will always be the same as type <code class="computeroutput"><span class="identifier">T</span></code>
|
||||
except where <a class="link" href="../category/transform.html#boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
|
||||
workarounds</a> have been applied.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Header:</strong></span> <code class="computeroutput"> <span class="preprocessor">#include</span>
|
||||
<span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">add_pointer</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
@ -126,7 +118,10 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
<br class="table-break"><p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> All current compilers
|
||||
are supported by this trait.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>add_reference</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="add_pointer.html" title="add_pointer">
|
||||
@ -51,14 +51,6 @@
|
||||
<p>
|
||||
<span class="bold"><strong>C++ Standard Reference:</strong></span> 8.3.2.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> If the compiler
|
||||
does not support partial specialization of class-templates then this template
|
||||
will compile, but the member <code class="computeroutput"><span class="identifier">type</span></code>
|
||||
will always be the same as type <code class="computeroutput"><span class="identifier">T</span></code>
|
||||
except where <a class="link" href="../category/transform.html#boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
|
||||
workarounds</a> have been applied.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Header:</strong></span> <code class="computeroutput"> <span class="preprocessor">#include</span>
|
||||
<span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">add_reference</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
@ -135,7 +127,10 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
<br class="table-break"><p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> All current compilers
|
||||
are supported by this trait.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>add_rvalue_reference</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="add_reference.html" title="add_reference">
|
||||
@ -44,12 +44,6 @@
|
||||
<p>
|
||||
<span class="bold"><strong>C++ Standard Reference:</strong></span> 20.7.6.2.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> If the compiler
|
||||
does not support partial specialization of class-templates and rvalue references
|
||||
then this template will compile, but the member <code class="computeroutput"><span class="identifier">type</span></code>
|
||||
will always be the same as type <code class="computeroutput"><span class="identifier">T</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Header:</strong></span> <code class="computeroutput"> <span class="preprocessor">#include</span>
|
||||
<span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">add_rvalue_reference</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
@ -151,7 +145,10 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
<br class="table-break"><p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> In the absence of
|
||||
rvalue-reference support this trait has no effect.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>add_volatile</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="add_rvalue_reference.html" title="add_rvalue_reference">
|
||||
@ -39,14 +39,6 @@
|
||||
<p>
|
||||
<span class="bold"><strong>C++ Standard Reference:</strong></span> 3.9.3.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> If the compiler
|
||||
does not support partial specialization of class-templates then this template
|
||||
will compile, but the member <code class="computeroutput"><span class="identifier">type</span></code>
|
||||
will always be the same as type <code class="computeroutput"><span class="identifier">T</span></code>
|
||||
except where <a class="link" href="../category/transform.html#boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
|
||||
workarounds</a> have been applied.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Header:</strong></span> <code class="computeroutput"> <span class="preprocessor">#include</span>
|
||||
<span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">/</span><span class="identifier">add_volatile</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
@ -125,7 +117,10 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
<br class="table-break"><p>
|
||||
<span class="bold"><strong>Compiler Compatibility:</strong></span> All current compilers
|
||||
are supported by this trait.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>aligned_storage</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="add_volatile.html" title="add_volatile">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>alignment_of</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="aligned_storage.html" title="aligned_storage">
|
||||
|
@ -3,11 +3,11 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>common_type</title>
|
||||
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
|
||||
<link rel="home" href="../../index.html" title="Chapter 1. Boost.TypeTraits">
|
||||
<link rel="up" href="../reference.html" title="Alphabetical Reference">
|
||||
<link rel="prev" href="conditional.html" title="conditional">
|
||||
<link rel="next" href="decay.html" title="decay">
|
||||
<link rel="next" href="copy_cv.html" title="copy_cv">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
@ -20,7 +20,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="conditional.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="decay.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="conditional.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="copy_cv.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
@ -32,115 +32,92 @@
|
||||
or <code class="computeroutput"> <span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">type_traits</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="special">...</span><span class="identifier">T</span><span class="special">></span> <span class="keyword">struct</span> <a class="link" href="common_type.html" title="common_type">common_type</a><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span><span class="special">...</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
</pre>
|
||||
<p>
|
||||
<a class="link" href="common_type.html" title="common_type">common_type</a>
|
||||
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..
|
||||
<code class="computeroutput"><span class="identifier">common_type</span></code> 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..
|
||||
</p>
|
||||
<p>
|
||||
The nested typedef <code class="computeroutput"><span class="special">::</span><span class="identifier">type</span></code>
|
||||
could be defined as follows:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="special">...</span><span class="identifier">T</span><span class="special">></span>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span><span class="special">...</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">,</span> <span class="keyword">class</span> <span class="special">...</span><span class="identifier">V</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span><span class="identifier">U</span><span class="special">,...</span><span class="identifier">V</span><span class="special">></span> <span class="special">{</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="link" href="common_type.html" title="common_type">common_type</a><span class="special"><</span><span class="keyword">typename</span> <a class="link" href="common_type.html" title="common_type">common_type</a><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">>::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">V</span><span class="special">...>::</span><span class="identifier">type</span> <span class="identifier">type</span><span class="special">;</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">,</span> <span class="keyword">class</span><span class="special">...</span> <span class="identifier">V</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">,</span> <span class="identifier">V</span><span class="special">...></span> <span class="special">{</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">>::</span><span class="identifier">type</span><span class="special">,</span> <span class="identifier">V</span><span class="special">...>::</span><span class="identifier">type</span> <span class="identifier">type</span><span class="special">;</span>
|
||||
<span class="special">};</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><></span>
|
||||
<span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special"><></span> <span class="special">{</span>
|
||||
<span class="special">};</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">{</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">T</span> <span class="identifier">type</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="link" href="decay.html" title="decay">decay</a><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">type</span><span class="special">;</span>
|
||||
<span class="special">};</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">></span> <span class="special">{</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">decltype</span><span class="special">(</span><a href="../../../../../utility/doc/html/declval.html" target="_top">declval</a><span class="special"><</span><span class="keyword">bool</span><span class="special">>()</span> <span class="special">?</span> <a href="../../../../../utility/doc/html/declval.html" target="_top">declval</a><span class="special"><</span><span class="identifier">T</span><span class="special">>()</span> <span class="special">:</span> <a href="../../../../../utility/doc/html/declval.html" target="_top">declval</a><span class="special"><</span><span class="identifier">U</span><span class="special">>())</span> <span class="identifier">type</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="link" href="decay.html" title="decay">decay</a><span class="special"><</span>
|
||||
<span class="keyword">decltype</span><span class="special">(</span> <a class="link" href="declval.html" title="declval">declval</a><span class="special"><</span><span class="keyword">bool</span><span class="special">>()?</span>
|
||||
<a class="link" href="declval.html" title="declval">declval</a><span class="special"><</span><span class="keyword">typename</span> <a class="link" href="decay.html" title="decay">decay</a><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">type</span><span class="special">>():</span>
|
||||
<a class="link" href="declval.html" title="declval">declval</a><span class="special"><</span><span class="keyword">typename</span> <a class="link" href="decay.html" title="decay">decay</a><span class="special"><</span><span class="identifier">U</span><span class="special">>::</span><span class="identifier">type</span><span class="special">>()</span> <span class="special">)</span>
|
||||
<span class="special">>::</span><span class="identifier">type</span> <span class="identifier">type</span><span class="special">;</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
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. <span class="bold"><strong>Note:</strong></span> Such specializations are required when only
|
||||
explicit conversions are desired among the <a class="link" href="common_type.html" title="common_type">common_type</a>
|
||||
explicit conversions are desired among the <code class="computeroutput"><span class="identifier">common_type</span></code>
|
||||
arguments.
|
||||
</p>
|
||||
<p>
|
||||
Note that when the compiler does not support variadic templates (and the
|
||||
macro BOOST_NO_VARIADIC_TEMPLATES is defined) then the maximum number of
|
||||
template arguments is 3.
|
||||
macro <code class="computeroutput"><span class="identifier">BOOST_NO_CXX11_VARIADIC_TEMPLATES</span></code>
|
||||
is defined) then the maximum number of template arguments is 9.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="boost_typetraits.reference.common_type.h0"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.reference.common_type.configuration_macros"></a></span><a class="link" href="common_type.html#boost_typetraits.reference.common_type.configuration_macros">Configuration
|
||||
macros</a>
|
||||
</h5>
|
||||
<p>
|
||||
When the compiler does not support static assertions then the user can select
|
||||
the way static assertions are reported. Define
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
BOOST_COMMON_TYPE_USES_STATIC_ASSERT: define it if you want to use Boost.StaticAssert
|
||||
</li>
|
||||
<li class="listitem">
|
||||
BOOST_COMMON_TYPE_USES_MPL_ASSERT: define it if you want to use Boost.MPL
|
||||
static assertions
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
Depending on the static assertion used you will have an hint of the failing
|
||||
assertion either through the symbol or through the text.
|
||||
</p>
|
||||
<p>
|
||||
When possible common_type is implemented using <code class="computeroutput"><span class="keyword">decltype</span></code>.
|
||||
Otherwise when BOOST_COMMON_TYPE_DONT_USE_TYPEOF is not defined it uses Boost.TypeOf.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="boost_typetraits.reference.common_type.h1"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.reference.common_type.tutorial"></a></span><a class="link" href="common_type.html#boost_typetraits.reference.common_type.tutorial">Tutorial</a>
|
||||
</h5>
|
||||
<p>
|
||||
In a nutshell, <a class="link" href="common_type.html" title="common_type">common_type</a>
|
||||
In a nutshell, <code class="computeroutput"><span class="identifier">common_type</span></code>
|
||||
is a trait that takes 1 or more types, and returns a type which all of the
|
||||
types will convert to. The default definition demands this conversion be
|
||||
implicit. However the trait can be specialized for user-defined types which
|
||||
want to limit their inter-type conversions to explicit, and yet still want
|
||||
to interoperate with the <a class="link" href="common_type.html" title="common_type">common_type</a>
|
||||
to interoperate with the <code class="computeroutput"><span class="identifier">common_type</span></code>
|
||||
facility.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Example:</strong></span>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">></span>
|
||||
<span class="identifier">complex</span><span class="special"><</span><span class="keyword">typename</span> <a class="link" href="common_type.html" title="common_type">common_type</a><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">>::</span><span class="identifier">type</span><span class="special">></span>
|
||||
<span class="identifier">complex</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">>::</span><span class="identifier">type</span><span class="special">></span>
|
||||
<span class="keyword">operator</span><span class="special">+(</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">>,</span> <span class="identifier">complex</span><span class="special"><</span><span class="identifier">U</span><span class="special">>);</span>
|
||||
</pre>
|
||||
<p>
|
||||
In the above example, "mixed-mode" complex arithmetic is allowed.
|
||||
The return type is described by <a class="link" href="common_type.html" title="common_type">common_type</a>.
|
||||
The return type is described by <code class="computeroutput"><span class="identifier">common_type</span></code>.
|
||||
For example the resulting type of adding a <code class="computeroutput"><span class="identifier">complex</span><span class="special"><</span><span class="keyword">float</span><span class="special">></span></code> and <code class="computeroutput"><span class="identifier">complex</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span></code> might be a <code class="computeroutput"><span class="identifier">complex</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span></code>.
|
||||
</p>
|
||||
<p>
|
||||
Here is how someone might produce a variadic comparison function:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="special">...</span><span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">typename</span> <a class="link" href="common_type.html" title="common_type">common_type</a><span class="special"><</span><span class="identifier">T</span><span class="special">...>::</span><span class="identifier">type</span>
|
||||
<span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special"><</span><span class="identifier">T</span><span class="special">...>::</span><span class="identifier">type</span>
|
||||
<span class="identifier">min</span><span class="special">(</span><span class="identifier">T</span><span class="special">...</span> <span class="identifier">t</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
This is a very useful and broadly applicable utility.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="boost_typetraits.reference.common_type.h2"></a>
|
||||
<a name="boost_typetraits.reference.common_type.h1"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.reference.common_type.how_to_get_the_common_type_of_types_with_explicit_conversions_"></a></span><a class="link" href="common_type.html#boost_typetraits.reference.common_type.how_to_get_the_common_type_of_types_with_explicit_conversions_">How
|
||||
to get the common type of types with explicit conversions?</a>
|
||||
</h5>
|
||||
@ -148,23 +125,23 @@
|
||||
Another choice for the author of the preceding operator could be
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">></span>
|
||||
<span class="keyword">typename</span> <a class="link" href="common_type.html" title="common_type">common_type</a><span class="special"><</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">>,</span> <span class="identifier">complex</span><span class="special"><</span><span class="identifier">U</span><span class="special">></span> <span class="special">>::</span><span class="identifier">type</span>
|
||||
<span class="keyword">typename</span> <span class="identifier">common_type</span><span class="special"><</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">>,</span> <span class="identifier">complex</span><span class="special"><</span><span class="identifier">U</span><span class="special">></span> <span class="special">>::</span><span class="identifier">type</span>
|
||||
<span class="keyword">operator</span><span class="special">+(</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">>,</span> <span class="identifier">complex</span><span class="special"><</span><span class="identifier">U</span><span class="special">>);</span>
|
||||
</pre>
|
||||
<p>
|
||||
As the default definition of <a class="link" href="common_type.html" title="common_type">common_type</a>
|
||||
As the default definition of <code class="computeroutput"><span class="identifier">common_type</span></code>
|
||||
demands the conversion be implicit, we need to specialize the trait for complex
|
||||
types as follows.
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <a class="link" href="common_type.html" title="common_type">common_type</a><span class="special"><</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">>,</span> <span class="identifier">complex</span><span class="special"><</span><span class="identifier">U</span><span class="special">></span> <span class="special">></span> <span class="special">{</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">complex</span><span class="special"><</span> <a class="link" href="common_type.html" title="common_type">common_type</a><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">></span> <span class="special">></span> <span class="identifier">type</span><span class="special">;</span>
|
||||
<span class="keyword">struct</span> <span class="identifier">common_type</span><span class="special"><</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">>,</span> <span class="identifier">complex</span><span class="special"><</span><span class="identifier">U</span><span class="special">></span> <span class="special">></span> <span class="special">{</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">complex</span><span class="special"><</span> <span class="identifier">common_type</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">U</span><span class="special">></span> <span class="special">></span> <span class="identifier">type</span><span class="special">;</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<h5>
|
||||
<a name="boost_typetraits.reference.common_type.h3"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.reference.common_type.how_important_is_the_order_of_the_common_type_lt__gt__template_arguments_"></a></span><a class="link" href="common_type.html#boost_typetraits.reference.common_type.how_important_is_the_order_of_the_common_type_lt__gt__template_arguments_">How
|
||||
important is the order of the common_type<> template arguments?</a>
|
||||
<a name="boost_typetraits.reference.common_type.h2"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.reference.common_type.how_important_is_the_order_of_the__code__phrase_role__identifier__common_type__phrase__phrase_role__special___lt__gt___phrase___code__template_arguments_"></a></span><a class="link" href="common_type.html#boost_typetraits.reference.common_type.how_important_is_the_order_of_the__code__phrase_role__identifier__common_type__phrase__phrase_role__special___lt__gt___phrase___code__template_arguments_">How
|
||||
important is the order of the <code class="computeroutput"><span class="identifier">common_type</span><span class="special"><></span></code> template arguments?</a>
|
||||
</h5>
|
||||
<p>
|
||||
The order of the template parameters is important.
|
||||
@ -242,9 +219,10 @@
|
||||
<span class="identifier">A</span><span class="special">></span></code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="boost_typetraits.reference.common_type.h4"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.reference.common_type.can_the_common_type_of_two_types_be_a_third_type_"></a></span><a class="link" href="common_type.html#boost_typetraits.reference.common_type.can_the_common_type_of_two_types_be_a_third_type_">Can
|
||||
the common_type of two types be a third type?</a>
|
||||
<a name="boost_typetraits.reference.common_type.h3"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.reference.common_type.can_the__code__phrase_role__identifier__common_type__phrase___code__of_two_types_be_a_third_type_"></a></span><a class="link" href="common_type.html#boost_typetraits.reference.common_type.can_the__code__phrase_role__identifier__common_type__phrase___code__of_two_types_be_a_third_type_">Can
|
||||
the <code class="computeroutput"><span class="identifier">common_type</span></code> of two types
|
||||
be a third type?</a>
|
||||
</h5>
|
||||
<p>
|
||||
Given the preceding example, one might expect <code class="computeroutput"><span class="identifier">common_type</span><span class="special"><</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">B</span><span class="special">>::</span><span class="identifier">type</span></code> to be <code class="computeroutput"><span class="identifier">C</span></code>
|
||||
@ -269,9 +247,10 @@
|
||||
<span class="identifier">B</span><span class="special">></span></code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="boost_typetraits.reference.common_type.h5"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.reference.common_type.how_common_type_behaves_with_pointers_"></a></span><a class="link" href="common_type.html#boost_typetraits.reference.common_type.how_common_type_behaves_with_pointers_">How
|
||||
common_type behaves with pointers?</a>
|
||||
<a name="boost_typetraits.reference.common_type.h4"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.reference.common_type.how_does__code__phrase_role__identifier__common_type__phrase___code__behave_with_pointers_"></a></span><a class="link" href="common_type.html#boost_typetraits.reference.common_type.how_does__code__phrase_role__identifier__common_type__phrase___code__behave_with_pointers_">How
|
||||
does <code class="computeroutput"><span class="identifier">common_type</span></code> behave with
|
||||
pointers?</a>
|
||||
</h5>
|
||||
<p>
|
||||
Consider
|
||||
@ -305,26 +284,32 @@
|
||||
Of course the user can always make this specialization.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="boost_typetraits.reference.common_type.h6"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.reference.common_type.can_you_explain_the_pros_cons_of_common_type_against_boost_typeof_"></a></span><a class="link" href="common_type.html#boost_typetraits.reference.common_type.can_you_explain_the_pros_cons_of_common_type_against_boost_typeof_">Can
|
||||
you explain the pros/cons of common_type against Boost.Typeof?</a>
|
||||
<a name="boost_typetraits.reference.common_type.h5"></a>
|
||||
<span class="phrase"><a name="boost_typetraits.reference.common_type.can_you_explain_the_pros_cons_of__code__phrase_role__identifier__common_type__phrase___code__against_boost_typeof_"></a></span><a class="link" href="common_type.html#boost_typetraits.reference.common_type.can_you_explain_the_pros_cons_of__code__phrase_role__identifier__common_type__phrase___code__against_boost_typeof_">Can
|
||||
you explain the pros/cons of <code class="computeroutput"><span class="identifier">common_type</span></code>
|
||||
against Boost.Typeof?</a>
|
||||
</h5>
|
||||
<p>
|
||||
Even if they appear to be close, <code class="computeroutput"><a class="link" href="common_type.html" title="common_type">common_type</a></code>
|
||||
Even if they appear to be close, <code class="computeroutput"><span class="identifier">common_type</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">typeof</span></code> have different
|
||||
purposes. You use <code class="computeroutput"><span class="identifier">typeof</span></code>
|
||||
to get the type of an expression, while you use <a class="link" href="common_type.html" title="common_type">common_type</a>
|
||||
to get the type of an expression, while you use <code class="computeroutput"><span class="identifier">common_type</span></code>
|
||||
to set explicitly the type returned of a template function. Both are complementary,
|
||||
and indeed <a class="link" href="common_type.html" title="common_type">common_type</a>
|
||||
is equivalent to <code class="computeroutput"><span class="keyword">decltype</span><span class="special">(</span><a href="../../../../../utility/doc/html/declval.html" target="_top">declval</a><span class="special"><</span><span class="keyword">bool</span><span class="special">>()</span> <span class="special">?</span> <a href="../../../../../utility/doc/html/declval.html" target="_top">declval</a><span class="special"><</span><span class="identifier">T</span><span class="special">>()</span>
|
||||
<span class="special">:</span> <a href="../../../../../utility/doc/html/declval.html" target="_top">declval</a><span class="special"><</span><span class="identifier">U</span><span class="special">>())</span></code>
|
||||
and indeed <code class="computeroutput"><span class="identifier">common_type</span></code> is
|
||||
approximately equivalent to <code class="computeroutput"><span class="keyword">decltype</span><span class="special">(</span><a class="link" href="declval.html" title="declval">declval</a><span class="special"><</span><span class="keyword">bool</span><span class="special">>()</span>
|
||||
<span class="special">?</span> <a class="link" href="declval.html" title="declval">declval</a><span class="special"><</span><span class="identifier">T</span><span class="special">>()</span>
|
||||
<span class="special">:</span> <a class="link" href="declval.html" title="declval">declval</a><span class="special"><</span><span class="identifier">U</span><span class="special">>())</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
<a class="link" href="common_type.html" title="common_type">common_type</a>
|
||||
is also similar to promote_args<class ...T> in boost/math/tools/promotion.hpp,
|
||||
though it is not exactly the same as promote_args either. <a class="link" href="common_type.html" title="common_type">common_type</a><T1,
|
||||
T2>::type simply represents the result of some operation on T1 and T2,
|
||||
and defaults to the type obtained by putting T1 and T2 into a conditional
|
||||
<code class="computeroutput"><span class="identifier">common_type</span></code> is also similar
|
||||
to <code class="computeroutput"><span class="identifier">promote_args</span><span class="special"><</span><span class="keyword">class</span> <span class="special">...</span><span class="identifier">T</span><span class="special">></span></code> in
|
||||
<code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">tools</span><span class="special">/</span><span class="identifier">promotion</span><span class="special">.</span><span class="identifier">hpp</span></code>, though
|
||||
it is not exactly the same as <code class="computeroutput"><span class="identifier">promote_args</span></code>
|
||||
either. <code class="computeroutput"><span class="identifier">common_type</span><span class="special"><</span><span class="identifier">T1</span><span class="special">,</span> <span class="identifier">T2</span><span class="special">>::</span><span class="identifier">type</span></code>
|
||||
simply represents the result of some operation on <code class="computeroutput"><span class="identifier">T1</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">T2</span></code>, and defaults to the
|
||||
type obtained by putting <code class="computeroutput"><span class="identifier">T1</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">T2</span></code> into a conditional
|
||||
statement.
|
||||
</p>
|
||||
<p>
|
||||
@ -346,7 +331,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="conditional.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="decay.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="conditional.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="copy_cv.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user