[/ 
  Copyright 2007 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).
]

[library Boost.TypeTraits
    [quickbook 1.5]
    [copyright 2000 2011 Adobe Systems Inc, David Abrahams, Frederic Bron,
    Steve Cleary, Beman Dawes, Glen Fernandes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones,
    Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen,
    Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven Watanabe]
    [purpose Meta-programming support library]
    [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])
    ]
    [authors [authors, various]]
    [category template]
    [category generic]
    [last-revision $Date$]
]

[include ../../../tools/auto_index/include/auto_index_helpers.qbk]

[def __boost_root ../../../../]
[def __tof '''<replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable>''']
[def __below '''<replaceable>see-below</replaceable>''']
[def __true_type [link boost_typetraits.reference.integral_constant true_type]]
[def __false_type [link boost_typetraits.reference.integral_constant false_type]]
[def __integral_constant [link boost_typetraits.reference.integral_constant integral_constant]]
[def __alias [*Aliases:]]
[def __inherit [*Inherits:]]
[def __std_paper [*C++ Standard Paper:]]
[def __std_ref [*C++ Standard Reference:]]
[def __header [*Header:]]
[def __compat [*Compiler Compatibility:]]
[def __examples [*Examples:]]
[def __type [*type:]]
[def __transform_workaround [link boost_typetraits.category.transform.broken_compiler_workarounds_ compiler workarounds]]
[def __intrinsics [link boost_typetraits.intrinsics intrinsics]]

[def __is_void [link boost_typetraits.reference.is_void is_void]]
[def __is_integral [link boost_typetraits.reference.is_integral is_integral]]
[def __is_floating_point [link boost_typetraits.reference.is_floating_point is_floating_point]]
[def __is_pointer [link boost_typetraits.reference.is_pointer is_pointer]]
[def __is_reference [link boost_typetraits.reference.is_reference is_reference]]
[def __is_lvalue_reference [link boost_typetraits.reference.is_lvalue_reference is_lvalue_reference]]
[def __is_rvalue_reference [link boost_typetraits.reference.is_rvalue_reference is_rvalue_reference]]
[def __is_member_pointer [link boost_typetraits.reference.is_member_pointer is_member_pointer]]
[def __is_array [link boost_typetraits.reference.is_array is_array]]
[def __is_bounded_array [link boost_typetraits.reference.is_bounded_array is_bounded_array]]
[def __is_unbounded_array [link boost_typetraits.reference.is_unbounded_array is_unbounded_array]]
[def __is_union [link boost_typetraits.reference.is_union is_union]]
[def __is_class [link boost_typetraits.reference.is_class is_class]]
[def __is_scoped_enum [link boost_typetraits.reference.is_scoped_enum is_scoped_enum]]
[def __is_unscoped_enum [link boost_typetraits.reference.is_unscoped_enum is_unscoped_enum]]
[def __is_enum [link boost_typetraits.reference.is_enum is_enum]]
[def __is_enum [link boost_typetraits.reference.is_enum is_enum]]
[def __is_function [link boost_typetraits.reference.is_function is_function]]

[def __is_arithmetic [link boost_typetraits.reference.is_arithmetic is_arithmetic]]
[def __is_fundamental [link boost_typetraits.reference.is_fundamental is_fundamental]]
[def __is_object [link boost_typetraits.reference.is_object is_object]]
[def __is_scalar [link boost_typetraits.reference.is_scalar is_scalar]]
[def __is_compound [link boost_typetraits.reference.is_compound is_compound]]
[def __is_member_function_pointer [link boost_typetraits.reference.is_member_function_pointer is_member_function_pointer]]
[def __is_member_object_pointer [link boost_typetraits.reference.is_member_object_pointer is_member_object_pointer]]

[def __alignment_of [link boost_typetraits.reference.alignment_of alignment_of]]
[def __rank [link boost_typetraits.reference.rank rank]]
[def __extent [link boost_typetraits.reference.extent extent]]
[def __is_empty [link boost_typetraits.reference.is_empty is_empty]]
[def __is_const [link boost_typetraits.reference.is_const is_const]]
[def __is_assignable [link boost_typetraits.reference.is_assignable is_assignable]]
[def __is_copy_constructible [link boost_typetraits.reference.is_copy_constructible is_copy_constructible]]
[def __is_copy_assignable [link boost_typetraits.reference.is_copy_assignable is_copy_assignable]]
[def __is_constructible [link boost_typetraits.reference.is_constructible is_constructible]]
[def __is_list_constructible [link boost_typetraits.reference.is_list_constructible is_list_constructible]]
[def __is_default_constructible [link boost_typetraits.reference.is_default_constructible is_default_constructible]]
[def __is_destructible [link boost_typetraits.reference.is_destructible is_destructible]]
[def __is_volatile [link boost_typetraits.reference.is_volatile is_volatile]]
[def __is_abstract [link boost_typetraits.reference.is_abstract is_abstract]]
[def __is_polymorphic [link boost_typetraits.reference.is_polymorphic is_polymorphic]]
[def __is_signed [link boost_typetraits.reference.is_signed is_signed]]
[def __is_unsigned [link boost_typetraits.reference.is_unsigned is_unsigned]]
[def __has_virtual_destructor [link boost_typetraits.reference.has_virtual_destructor has_virtual_destructor]]
[def __is_trivially_copyable [link boost_typetraits.reference.is_trivially_copyable is_trivially_copyable]]
[def __is_pod [link boost_typetraits.reference.is_pod is_pod]]
[def __is_final [link boost_typetraits.reference.is_final is_final]]
[def __has_trivial_constructor [link boost_typetraits.reference.has_trivial_constructor has_trivial_constructor]]
[def __has_new_operator [link boost_typetraits.reference.has_new_operator has_new_operator]]
[def __has_trivial_copy [link boost_typetraits.reference.has_trivial_copy has_trivial_copy]]
[def __has_trivial_default_constructor [link boost_typetraits.reference.has_trivial_constructor has_trivial_default_constructor]]
[def __has_trivial_copy_constructor [link boost_typetraits.reference.has_trivial_copy has_trivial_copy_constructor]]
[def __has_trivial_move_constructor [link boost_typetraits.reference.has_trivial_move_constructor has_trivial_move_constructor]]
[def __has_trivial_assign [link boost_typetraits.reference.has_trivial_assign has_trivial_assign]]
[def __has_trivial_move_assign [link boost_typetraits.reference.has_trivial_move_assign has_trivial_move_assign]]
[def __has_trivial_destructor [link boost_typetraits.reference.has_trivial_destructor has_trivial_destructor]]
[def __is_stateless [link boost_typetraits.reference.is_stateless is_stateless]]
[def __has_nothrow_constructor [link boost_typetraits.reference.has_nothrow_constructor has_nothrow_constructor]]
[def __has_nothrow_copy [link boost_typetraits.reference.has_nothrow_copy has_nothrow_copy]]
[def __has_nothrow_default_constructor [link boost_typetraits.reference.has_nothrow_constructor has_nothrow_default_constructor]]
[def __has_nothrow_copy_constructor [link boost_typetraits.reference.has_nothrow_copy has_nothrow_copy_constructor]]
[def __has_nothrow_destructor [link boost_typetraits.reference.has_nothrow_destruct has_nothrow_destructor]]
[def __is_nothrow_move_constructible [link boost_typetraits.reference.is_nothrow_move_constructible is_nothrow_move_constructible]]
[def __has_nothrow_assign [link boost_typetraits.reference.has_nothrow_assign has_nothrow_assign]]
[def __is_nothrow_move_assignable [link boost_typetraits.reference.is_nothrow_move_assignable is_nothrow_move_assignable]]
[def __is_swappable [link boost_typetraits.reference.is_swappable is_swappable]]
[def __is_nothrow_swappable [link boost_typetraits.reference.is_nothrow_swappable is_nothrow_swappable]]

[def __is_base_of [link boost_typetraits.reference.is_base_of is_base_of]]
[def __is_virtual_base_of [link boost_typetraits.reference.is_virtual_base_of is_virtual_base_of]]
[def __is_convertible [link boost_typetraits.reference.is_convertible is_convertible]]
[def __is_same [link boost_typetraits.reference.is_same is_same]]

[def __remove_const [link boost_typetraits.reference.remove_const remove_const]]
[def __remove_volatile [link boost_typetraits.reference.remove_volatile remove_volatile]]
[def __remove_cv [link boost_typetraits.reference.remove_cv remove_cv]]
[def __remove_cv_ref [link boost_typetraits.reference.remove_cv_ref remove_cv_ref]]
[def __remove_reference [link boost_typetraits.reference.remove_reference remove_reference]]
[def __remove_extent [link boost_typetraits.reference.remove_extent remove_extent]]
[def __remove_all_extents [link boost_typetraits.reference.remove_all_extents remove_all_extents]]
[def __remove_pointer [link boost_typetraits.reference.remove_pointer remove_pointer]]
[def __add_reference [link boost_typetraits.reference.add_reference add_reference]]
[def __add_lvalue_reference [link boost_typetraits.reference.add_lvalue_reference add_lvalue_reference]]
[def __add_rvalue_reference [link boost_typetraits.reference.add_rvalue_reference add_rvalue_reference]]
[def __add_pointer [link boost_typetraits.reference.add_pointer add_pointer]]
[def __add_const [link boost_typetraits.reference.add_const add_const]]
[def __add_volatile [link boost_typetraits.reference.add_volatile add_volatile]]
[def __add_cv [link boost_typetraits.reference.add_cv add_cv]]
[def __common_type [link boost_typetraits.reference.common_type common_type]]
[def __conditional [link boost_typetraits.reference.conditional conditional]]
[def __conjunction [link boost_typetraits.reference.conjunction conjunction]]
[def __disjunction [link boost_typetraits.reference.disjunction disjunction]]
[def __negation [link boost_typetraits.reference.negation negation]]

[def __type_with_alignment [link boost_typetraits.reference.type_with_alignment type_with_alignment]]
[def __aligned_storage [link boost_typetraits.reference.aligned_storage aligned_storage]]

[def __function_traits [link boost_typetraits.reference.function_traits function_traits]]

[def __promote [link boost_typetraits.reference.promote promote]]
[def __integral_promotion [link boost_typetraits.reference.integral_promotion integral_promotion]]
[def __floating_point_promotion [link boost_typetraits.reference.floating_point_promotion floating_point_promotion]]

[def __make_signed [link boost_typetraits.reference.make_signed make_signed]]
[def __make_unsigned [link boost_typetraits.reference.make_unsigned make_unsigned]]
[def __make_void [link boost_typetraits.reference.make_void make_void]]
[def __decay [link boost_typetraits.reference.decay decay]]
[def __is_complex [link boost_typetraits.reference.is_complex is_complex]]

[def __copy_cv [link boost_typetraits.reference.copy_cv copy_cv]]
[def __copy_cv_ref [link boost_typetraits.reference.copy_cv_ref copy_cv_ref]]
[def __copy_reference [link boost_typetraits.reference.copy_reference copy_reference]]
[def __type_identity [link boost_typetraits.reference.type_identity type_identity]]
[def __declval [link boost_typetraits.reference.declval declval]]

[def __detected [link boost_typetraits.reference.detected detected]]
[def __detected_or [link boost_typetraits.reference.detected_or detected_or]]
[def __is_detected [link boost_typetraits.reference.is_detected is_detected]]
[def __is_detected_convertible [link boost_typetraits.reference.is_detected_convertible is_detected_convertible]]
[def __is_detected_exact [link boost_typetraits.reference.is_detected_exact is_detected_exact]]
[def __nonesuch [link boost_typetraits.reference.nonesuch nonesuch]]

[def __is_complete [link boost_typetraits.reference.is_complete is_complete]]

[def __compat [*Compiler Compatibility:]]
[template all_compilers[] __compat All current compilers are supported by this trait.]
[template has_binary_operator_compat[] __compat Requires working SFINAE (i.e. BOOST_NO_SFINAE is not set).  Only a minority of rather old compilers do not support this.]

[template binary_operator_known_issues[Name Op Ret1 Ret2 Const]
[*Known issues:]

For modern compilers (those that support arbitrary SFINAE-expressions and decltype/declval) this trait offers near perfect detection.
In this situation the macro `BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION` will be defined after including
[^<boost/type_traits/[Name].hpp>].  Please note however, that detection is based on function signature only, 
in the case that the operator is a function template then [Name] cannot perform
introspection of the template function body to ensure that the type meets all of the conceptual requirements of the actual code.

Example:


   #include <boost/type_traits/``[Name]``.hpp>
   #include <iostream>
   
   template <class T>
   struct contains 
   { 
      T data; 
      contains(const T& d) : data(d) {}   
   };

   template <class T>
   ``[Ret2]`` operator ``[Op]`` (``[Const]``contains<T> &lhs, const contains<T> &rhs) {
	   return f(lhs.data, rhs.data);
   }

   class bad { };
   class good { };
   good f(const good&, const good&) { return /*something*/; }

   int main() {
	   std::cout<<std::boolalpha;
	   // works fine for contains<good>
	   std::cout<<boost::``[Name]``< contains< good > >::value<<'\n'; // true
	   contains<good> g;
	   g&g; // ok
	   // does not work for contains<bad>
	   std::cout<<boost::``[Name]``< contains< bad > >::value<<'\n'; // true, should be false
	   contains<bad> b;
	   b&b; // compile time error
	   return 0;
   }

For older compilers (`BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION` not defined) then there are  a number of issues:

* This trait cannot detect whether binary `operator`[Op] is public or not:
if `operator`[Op] is defined as a private member of `Lhs` then
instantiating [^[Name]<Lhs>] will produce a compiler error.
For this reason [^[Name]] cannot be used to determine whether a type has a public `operator`[Op] or not.

   struct A { private: ``[Ret1]`` operator ``[Op]`` (const A&); };
   boost::``[Name]``<A>::value; // error: A::operator ``[Op]`` (const A&) is private


* There is an issue if the operator exists only for type `A` and `B` is
convertible to `A`. In this case, the compiler will report an ambiguous overload.

   struct A { };
   ``[Ret1]`` operator ``[Op]`` (``[Const]``A&, const A&);
   struct B { operator A(); };
   boost::``[Name]``<A>::value; // this is fine
   boost::``[Name]``<B>::value; // error: ambiguous overload


* `volatile` qualifier is not properly handled and would lead to undefined behavior
]
[template prefix_operator_known_issues[Name Op]
[*Known issues:]

For modern compilers (those that support arbitrary SFINAE-expressions and decltype/declval) this trait offers near perfect detection.
In this situation the macro `BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION` will be defined after including
[^<boost/type_traits/[Name].hpp>].  Please note however, that detection is based on function signature only, 
in the case that the operator is a function template then [Name] cannot perform
introspection of the template function body to ensure that the type meets all of the conceptual requirements of the actual code.

For older compilers (`BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION` not defined) then there are  a number of issues:

* This trait cannot detect whether unary `operator`[Op] is public or not:
if `operator`[Op] is defined as a private class member of type T then
instantiating [^[Name]<T>] will produce a compiler error.
For this reason [^[Name]] cannot be used to determine whether a type has a public `operator`[Op] or not.

* `volatile` qualifier is not properly handled and would lead to undefined behavior

* Capturless lambdas are not supported and will lead to a compiler error if [Name] is instantiated
on the lambda type.

* Scoped enum types are not supported and will lead to a compiler error if [Name] is instantiated on such a type.

]


A printer-friendly [@http://sourceforge.net/projects/boost/files/boost-docs/ 
 PDF version of this manual is also available].

[section:intro Introduction]

The Boost type-traits library contains a 
set of very specific traits classes, each of which encapsulate a single trait 
from the C++ type system; for example, is a type a pointer or a reference type? 
Or does a type have a trivial constructor, or a const-qualifier?
 
The type-traits classes share a unified design: each class inherits from  
the type __true_type if the type has the specified property and inherits from
__false_type otherwise.

The type-traits library also contains a set of classes that perform a 
specific transformation on a type; for example, they can remove a 
top-level const or volatile qualifier from a type. Each class that 
performs a transformation defines a single typedef-member `type` 
that is the result of the transformation.

[endsect]

[include background.qbk]

[section:category Type Traits by Category]

[include value_traits.qbk]
[include transform_traits.qbk]
[include alignment_traits.qbk]
[include decomposing_func.qbk]

[endsect]

[include user_defined.qbk]
[include intrinsics.qbk]
[include mpl.qbk]
[include examples.qbk]

[section:reference Alphabetical Reference]

[include add_const.qbk]
[include add_cv.qbk]
[include add_lvalue_reference.qbk]
[include add_pointer.qbk]
[include add_reference.qbk]
[include add_rvalue_reference.qbk]
[include add_volatile.qbk]
[include aligned_storage.qbk]
[include alignment_of.qbk]
[include conditional.qbk]
[include conjunction.qbk]
[include common_type.qbk]
[include copy_cv.qbk]
[include copy_cv_ref.qbk]
[include copy_reference.qbk]
[include decay.qbk]
[include declval.qbk]
[include detected.qbk]
[include detected_or.qbk]
[include disjunction.qbk]
[include enable_if.qbk]
[include extent.qbk]
[include floating_point_promotion.qbk]
[include function_traits.qbk]

[include has_bit_and.qbk]
[include has_bit_and_assign.qbk]
[include has_bit_or.qbk]
[include has_bit_or_assign.qbk]
[include has_bit_xor.qbk]
[include has_bit_xor_assign.qbk]
[include has_complement.qbk]
[include has_dereference.qbk]
[include has_divides.qbk]
[include has_divides_assign.qbk]
[include has_equal_to.qbk]
[include has_greater.qbk]
[include has_greater_equal.qbk]
[include has_left_shift.qbk]
[include has_left_shift_assign.qbk]
[include has_less.qbk]
[include has_less_equal.qbk]
[include has_logical_and.qbk]
[include has_logical_not.qbk]
[include has_logical_or.qbk]
[include has_minus.qbk]
[include has_minus_assign.qbk]
[include has_modulus.qbk]
[include has_modulus_assign.qbk]
[include has_multiplies.qbk]
[include has_multiplies_assign.qbk]
[include has_negate.qbk]
[include has_new_operator.qbk]
[include has_not_equal_to.qbk]
[include has_nothrow_assign.qbk]
[include has_nothrow_constructor.qbk]
[include has_nothrow_copy.qbk]
[include has_nothrow_destruct.qbk]
[section:has_nothrow_cp_cons has_nothrow_copy_constructor]
See __has_nothrow_copy.
[endsect]
[section:has_no_throw_def_cons has_nothrow_default_constructor]
See __has_nothrow_constructor.
[endsect]
[include has_plus.qbk]
[include has_plus_assign.qbk]
[include has_post_decrement.qbk]
[include has_post_increment.qbk]
[include has_pre_decrement.qbk]
[include has_pre_increment.qbk]
[include has_right_shift.qbk]
[include has_right_shift_assign.qbk]
[include has_trivial_assign.qbk]
[include has_trivial_constructor.qbk]
[include has_trivial_copy.qbk]
[section:has_trivial_cp_cons has_trivial_copy_constructor]
See __has_trivial_copy.
[endsect]
[section:has_trivial_def_cons has_trivial_default_constructor]
See __has_trivial_constructor.
[endsect]
[include has_trivial_destructor.qbk]
[include has_trivial_move_assign.qbk]
[include has_trivial_move_constructor.qbk]
[include has_unary_minus.qbk]
[include has_unary_plus.qbk]
[include has_virtual_destructor.qbk]

[include integral_constant.qbk]
[include integral_promotion.qbk]

[include is_abstract.qbk]
[include is_arithmetic.qbk]
[include is_array.qbk]
[include is_assignable.qbk]
[include is_base_of.qbk]
[include is_bounded_array.qbk]
[include is_class.qbk]
[include is_complete.qbk]
[include is_complex.qbk]
[include is_compound.qbk]
[include is_const.qbk]
[include is_constructible.qbk]
[include is_convertible.qbk]
[include is_copy_assignable.qbk]
[include is_copy_constructible.qbk]
[include is_default_constructible.qbk]
[include is_destructible.qbk]
[include is_detected.qbk]
[include is_detected_convertible.qbk]
[include is_detected_exact.qbk]
[include is_empty.qbk]
[include is_enum.qbk]
[include is_final.qbk]
[include is_floating_point.qbk]
[include is_function.qbk]
[include is_fundamental.qbk]
[include is_integral.qbk]
[include is_list_constructible.qbk]
[include is_lvalue_reference.qbk]
[include is_member_function_pointer.qbk]
[include is_member_object_pointer.qbk]
[include is_member_pointer.qbk]
[include is_nothrow_move_assignable.qbk]
[include is_nothrow_move_constructible.qbk]
[include is_nothrow_swappable.qbk]
[include is_object.qbk]
[include is_pod.qbk]
[include is_pointer.qbk]
[include is_polymorphic.qbk]
[include is_reference.qbk]
[include is_rvalue_reference.qbk]
[include is_same.qbk]
[include is_scalar.qbk]
[include is_scoped_enum.qbk]
[include is_signed.qbk]
[include is_stateless.qbk]
[include is_swappable.qbk]
[include is_trivially_copyable.qbk]
[include is_unbounded_array.qbk]
[include is_union.qbk]
[include is_unscoped_enum.qbk]
[include is_unsigned.qbk]
[include is_virtual_base_of.qbk]
[include is_void.qbk]
[include is_volatile.qbk]

[include make_signed.qbk]
[include make_unsigned.qbk]
[include make_void.qbk]
[include negation.qbk]
[include nonesuch.qbk]

[include promote.qbk]
[include rank.qbk]

[include remove_all_extents.qbk]
[include remove_const.qbk]
[include remove_cv.qbk]
[include remove_cv_ref.qbk]
[include remove_extent.qbk]
[include remove_pointer.qbk]
[include remove_reference.qbk]
[include remove_volatile.qbk]
[include type_identity.qbk]
[include type_with_alignment.qbk]

[endsect]

[include history.qbk]
[include credits.qbk]

[named_index class_name Class Index]
[named_index typedef_name Typedef Index]
[named_index macro_name Macro Index]
[index]



