What Is the C++ Standard Library Type Identification Library?
The C++ type identification library gives you typeid, std::type_info and std::type_index for run-time type checks. See how RTTI works and when to avoid it.
Spread Your Knowledge. Questions with answers, tutorials and articles, newest first.
The C++ type identification library gives you typeid, std::type_info and std::type_index for run-time type checks. See how RTTI works and when to avoid it.
How to convert pointers safely in C++: the four cast operators, the shared_ptr cast functions in memory, and when to avoid casts altogether.
dynamic_cast is the C++ operator for checked casts in polymorphic hierarchies. See pointer and reference forms, bad_cast, costs and alternatives like std::variant.
The C++ <complex> header defines std::complex and its math functions. See its memory layout, constexpr use and practical Mandelbrot and Fourier examples.
C++17 added Bessel, Legendre, Hermite, elliptic integral, beta and zeta functions to cmath. See the correct std names, examples and expected output.
C++ math lives in cmath, numeric, numbers and limits. Learn the key functions, constants, algorithms and precision pitfalls with working examples.
std::numeric_limits reports the range, precision and special values of arithmetic types. See how min, max, lowest and epsilon work and where they mislead.
How to convert between strings and numbers in modern C++, from std::stoi and std::to_string to the exception-free std::from_chars and std::to_chars.
C++ type transformation traits build new types at compile time. See remove_const, add_pointer, decay, common_type and conditional with C++20 examples.
The C++ type relationships library lets templates compare two types at compile time with is_same, is_base_of and is_convertible. See how to use each one.
The C++ type properties library in <type_traits> answers compile-time questions about a type, such as const, trivially copyable or nothrow movable.
The C++ type traits library inspects and transforms types at compile time. See the main traits, the _v and _t shorthands, if constexpr and C++20 concepts.
Nullary function objects are C++ callables that take no arguments. See how to write them and where threads, async and call_once use them.
C++23 added and_then, transform and or_else to std::optional and std::expected. See how to chain fallible steps without nested if checks.
std::reference_wrapper stores a rebindable reference you can copy and put in containers. See std::ref, std::cref, thread and bind usage, and lifetime pitfalls.
std::bind creates a new callable by fixing or reordering arguments of an existing one. See how it works, its pitfalls, and why lambdas and bind_front are often better.
C++ smart pointers manage memory automatically with RAII. Learn when to use unique_ptr, shared_ptr and weak_ptr, with tested examples and common pitfalls.
std::vector is the C++ Standard Library dynamic array. See how to create, grow, erase and reserve it, and which pitfalls like iterator invalidation to avoid.
The C++ uninitialized memory library builds objects in raw storage you allocate yourself. See the functions, correct allocation and how to destroy objects.
The C++ Standard Library manages heap memory with smart pointers, allocators and polymorphic memory resources. See how to use them instead of raw new and delete.