Type support library
Curated hub for C++ type support: traits, transformations, numeric limits, fixed language support types, and RTTI/type identity utilities.
The C++ type support library provides the reusable machinery that generic code uses to inspect, transform, classify, and compare types. It also hosts fixed support types such as size_t, ptrdiff_t, and nullptr_t, numeric limits, byte/endian helpers, and the runtime type information surfaces built around type_info and type_index.
# Start Here
Ask compile-time questions about a type
Use the traits route when you need to test whether a type is integral, constructible, polymorphic, trivially copyable, or otherwise belongs to a category.
Transform one type into another
Start here for add/remove qualifier helpers, pointer/reference transformations, decay, common-type selection, and type identity tools.
remove_cv · remove_reference · add_pointer · decay · type_identity
Query representation limits and machine-facing properties
Use limits and representation helpers when code depends on value ranges, alignment, object representation, byte order, or low-level type facts.
numeric_limits · alignment_of · endian · byte
Work with runtime type information
Choose the RTTI route when dynamic type inspection, `typeid`, or associative storage keyed by runtime type identity is the main concern.
Use standard fixed support types
Start here when you need the library-defined types that generic code and low-level APIs commonly rely on.
size_t · ptrdiff_t · nullptr_t · max_align_t
Control templates and overload participation
Use the metaprogramming-oriented route when substitution, detection, trait composition, or overload gating drives the design.
enable_if · void_t · conjunction · disjunction · conditional
# Quick Map
| If you need to... | Start with | Why | Common adjacent route |
|---|---|---|---|
| Test a property of a type at compile time | type traits | The `is_*`, `has_*`, and related traits answer category and capability questions for generic code. | concepts |
| Strip, add, or normalize qualifiers, references, pointers, or array layers | type transformations | The add/remove/decay family is the canonical route for turning one type form into another. | utility |
| Find a common type or reference across several inputs | common_type or common_reference | These helpers model type unification rather than simple yes/no property tests. | ranges |
| Inspect value ranges, alignment, or representation limits | numeric_limits, alignment_of, endian | These are the core type-support entry points for machine-facing facts about types and objects. | numerics |
| Use library-defined fundamental support types | size_t, ptrdiff_t, nullptr_t | These types appear across the library and are the standard entry points for sizes, pointer differences, and null pointer type identity. | language types |
| Perform runtime type inspection or type-keyed lookup | type_info and type_index | This is the RTTI route when compile-time trait reasoning is not enough. | diagnostics |
| Constrain templates or enable overloads conditionally | enable_if, void_t, conjunction | These utilities are the traditional metaprogramming route for substitution-based selection. | concepts |
# Version Highlights
| Standard | Notable additions here | Why it changes navigation |
|---|---|---|
| C++11 | core trait expansion, alignment helpers, type_index, underlying_type | Established the modern trait-heavy baseline that most generic libraries now assume. |
| C++14 | integer aliases and refinements, broader trait cleanup | Mostly incremental, but relevant for portability when using trait conveniences across older toolchains. |
| C++17 | void_t, conjunction, disjunction, byte, object representation helpers | Added the trait-composition toolkit and more explicit representation-oriented support. |
| C++20 | remove_cvref, type_identity, endian, is_constant_evaluated | Improved modern generic programming patterns and low-level portability helpers. |
| C++23 | reference-from-temporary traits, is_implicit_lifetime, is_scoped_enum | Expanded the library's ability to express newer lifetime and type-safety questions directly. |
| C++26 | is_virtual_base_of, is_within_lifetime | Continues the trend toward more explicit compile-time reflection of language object-model properties. |
# Boundary Lines
| If the real question is about... | Go here instead | Why |
|---|---|---|
| How types are declared, formed, deduced, or interpreted by the language | Language | `/cpp/types/` is the library support layer, not the primary home for syntax, declarators, or core type-system rules. |
| Vocabulary types, move/forward helpers, formatting, or callable wrappers | Utility | The utility hub owns runtime support objects and value-oriented helper facilities, while this page focuses on type-support infrastructure. |
| Constraints and concept-based template interfaces | Concepts | Traits often feed concepts, but concept vocabulary and constrained interfaces belong to the concepts hub. |
| Exceptions, `bad_cast`, or runtime failure behavior as diagnostics concerns | Diagnostics | RTTI surfaces touch some diagnostic types, but the full exception/diagnostic taxonomy is elsewhere. |
| The C compatibility side of support types and limits | C types | The C side remains a separate library surface with different naming and compatibility concerns. |