boost.png (6897 bytes) Home Libraries People FAQ More

PrevUpHomeNext

Chapter 14. Boost.TypeTraits

various authors

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 )

Table of Contents

Introduction
Background and Tutorial
Type Traits by Category
Type Traits that Describe the Properties of a Type
Type Traits that Transform One Type to Another
Synthesizing Types with Specific Alignments
Decomposing Function Types
User Defined Specializations
Support for Compiler Intrinsics
MPL Interoperability
Examples
An Optimized Version of std::copy
An Optimised Version of std::fill
An Example that Omits Destructor Calls For Types with Trivial Destructors
An improved Version of std::iter_swap
Alphabetical Reference
add_const
add_cv
add_pointer
add_reference
add_volatile
aligned_storage
alignment_of
extent
function_traits
has_nothrow_assign
has_nothrow_constructor
has_nothrow_copy
has_trivial_assign
has_trivial_constructor
has_trivial_copy
has_trivial_destructor
has_virtual_destructor
integral_constant
is_abstract
is_arithmetic
is_array
is_base_of
is_class
is_compound
is_const
is_convertible
is_empty
is_enum
is_floating_point
is_function
is_fundamental
is_integral
is_member_function_pointer
is_member_object_pointer
is_member_pointer
is_object
is_pod
is_pointer
is_polymorphic
is_same
is_scalar
is_stateless
is_reference
is_union
is_void
is_volatile
rank
remove_all_extents
remove_const
remove_cv
remove_extent
remove_pointer
remove_reference
remove_volatile
type_with_alignment
Credits

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 a 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.

Last revised: August 24, 2005 at 16:49:32 GMT


PrevUpHomeNext