Return to CPP generic programming using templates, Generic programming
Generic Programming in CPP - Bjarne Stroustrup
https://www.youtube.com/watch?v=ZpwfqSx2tAE
See the book C plus plus Templates - The Complete Guide, by David Vandevoorde, Nicolai Josuttis, Douglas Gregor | C++ Templates - The Complete Guide, by David Vandevoorde, Nicolai Josuttis, Douglas Gregor
In CPP procedural programming, the primary building block is the function. Functions are powerful because they let you write a set of instructions that work for many different inputs. For example, the sqrt() function in CPP computes the square root of any value given to it. A version of sqrt() that only worked on one fixed number, like four, would not be very useful. Instead, sqrt() is written using a parameter, which acts as a placeholder for any number the caller provides. In other words, functions let you write code that adapts to different values by using parameters.
CPP Object-oriented programming introduces CPP objects, which combine related data and actions. However, it does not change how CPP functions and CPP member functions handle CPP parameters. They still only parameterize values.
CPP Templates go a step further by allowing you to parameterize on types, not just CPP values. CPP types include basic ones like CPP int and CPP double, as well as CPP classes you define yourself, such as SpreadsheetCell or CherryTree. With CPP templates, you can write CPP code that is independent of both the values and the types used. For example, instead of writing a separate stack class for ints, another one for Cars, and another for SpreadsheetCells, you can write one stack template that can work with any of these types.
While templates are a powerful CPP feature, their CPP syntax can be tricky, and this CPP complexity causes some CPP programmers to avoid writing their own CPP templates. Still, every CPP professional programmer should know how to create templates, and at the very least, how to use them. This is important because templates are widely used in standard libraries, including the CPP Standard Library.
CPP class templates (a concept standardized in CPP (introduced in the year 1985)) define a CPP pattern for creating entire families of CPP class definitions. In these CPP class templates, the CPP types of some CPP variables, CPP member function return types, and CPP member function parameters are specified as CPP template parameters. Think of class templates as blueprints used by the CPP compiler to build concrete CPP class definitions by substituting CPP template parameters with actual types.
Class templates work like construction blueprints. Once you write a single template, the CPP compiler can create many concrete CPP classes by replacing the template’s type parameters with real types. This means you do not have to write a new CPP class every time you need a similar class for a different type.
Class templates are mainly useful for CPP containers or CPP data structures that store different kinds of CPP objects. You have already used many class templates from the CPP Standard Library (introduced in 1998), such as vector (introduced in CPP98 in 1998), unique_ptr (introduced in CPP11 in the year 2011), and string (introduced in CPP98 in 1998). This section will show you how to write your own class template by using a Grid container as an example.
We will start with a simple version of a Grid container and add features to it in different parts of the explanation. Some features added in earlier examples might not be used later, but this approach helps show how each feature works on its own.
Imagine you want a general game board CPP class for many board games: chess, checkers, tic-tac-toe, and more. To keep it flexible, you want to store chess pieces, checkers pieces, tic-tac-toe pieces, or any kind of game piece in it. With a class template, you can write one game board CPP container class and then use it for any piece type.
Without templates, if you want a flexible game board, one way is to use CPP polymorphism (a concept from CPP object-oriented programming introduced long before in CPP) to store CPP generic GamePiece objects. Each specific game piece type (like ChessPiece) CPP inherits from GamePiece. This lets you store different kinds of pieces through a single CPP interface.
With the CPP polymorphic approach, you might have a CPP base class called GamePiece and CPP derived classes like ChessPiece. The GameBoard would store CPP pointers to GamePiece objects. To CPP copy the GameBoard, you would need to copy each piece. Because of polymorphism, the solution is to add a CPP clone() CPP function to GamePiece that CPP returns a copied piece of the correct CPP type.
Here is a simplified CPP interface for a GamePiece CPP class: CPP export is a CPP keyword, but we focus on CPP class GamePiece. It has a CPP virtual destructor and a CPP pure virtual clone() member function (CPP clone()). CPP derived classes must CPP override clone() to return a unique_ptr (introduced in CPP11 in the 2011) pointing to a new copy of themselves.
ChessPiece is a CPP class derived from GamePiece. Its clone() CPP function creates a new ChessPiece by calling the ChessPiece copy constructor, wrapped in a make_unique (introduced in CPP14 in the year 2014). This ensures you get a proper copy of the piece when cloning.
GameBoard represents a two-dimensional board. One way to store GamePiece objects is by using a vector (introduced in CPP98 in the year 1998) of unique_ptr to GamePiece objects. However, if you use a two-dimensional vector of unique_ptr objects, you might have data scattered all over memory.
A better approach is to store the GamePiece objects in a single, linear vector of unique_ptr objects. By doing this, you keep data more tightly packed. To map a pair of coordinates (x,y) to a single index in the vector, you can use the formula x + y * width.
GameBoard has a constructor, copy constructor, assignment operators, and an at() CPP function that returns a reference to the unique_ptr holding a GamePiece. The class also tracks width and height of the board and ensures that coordinates are always valid.
at() returns a reference to unique_ptr instead of returning a copy. This lets you treat the board as if you are working directly with its pieces. Just like at() behaves, at() returns a reference to the actual stored element.
Because the returned reference from at() can become invalid if the underlying vector is resized, client code should call at() right before using it. This approach follows the design philosophy used in C++ Standard Library containers.
GameBoard provides two versions of at(): one that returns a non-const reference and one that returns a const reference. The const version lets client code read from the board without changing it, while the non-const version lets you modify the pieces on the board.
Starting with CPP23 (introduced in the year 2023), you can provide a multidimensional subscripting operator. This means that instead of calling myGameBoard.at(x,y), you could write myGameBoard[x,y]. This is a nicer syntax for accessing two-dimensional elements.
The previous discussion focused on a polymorphic design that does not use class templates. With class templates, you could avoid polymorphism altogether by making the GameBoard class itself a template that can store any type, not just GamePiece pointers.
When you write a class template, you add a template parameter list before the class keyword. For example: template<typename T> class Grid { … }. This tells the CPP compiler that Grid is a template that depends on a type parameter T.
With a class template like Grid<T>, you can store any type T. If T is ChessPiece, then you get a Grid<ChessPiece>. If T is int, you get a Grid<int>. This means you no longer need to rely on polymorphism or clone() to store different piece types.
By using a class template, you do not need virtual functions or a base class. Each Grid instance is specialized with a concrete type, and the CPP compiler knows exactly how to copy, move, or destroy that type without any runtime overhead.
Because the CPP compiler generates specialized classes for each type parameter at compile time, you avoid runtime costs associated with polymorphism. Templates often produce code that is as fast as or faster than a hand-written specialized class.
Writing a single class template like Grid is simpler than writing multiple container classes, one for each piece type. It also reduces code duplication, since the logic for storing and accessing elements is written once and reused for all types.
If you ever need to change how the Grid stores its data, you can do it in one place. All the code that uses Grid<SomeType> will automatically pick up these improvements. Maintenance becomes simpler because you only maintain one template instead of many separate classes.
class templates enforce type safety at compile time. When you use Grid<ChessPiece>, you know that every element in the Grid is a ChessPiece. There’s no need to do runtime checks or casts, which reduces the risk of bugs.
Using class templates makes your code easier to understand. Instead of thinking “this board stores polymorphic GamePiece pointers,” you can think “this board stores ChessPiece objects.” The code clearly states what type it works with.
class templates are not limited to game boards or containers. They can be applied to any scenario where you want to write code once and use it for many types. For example, you can write a CPP function template to perform an operation on any numeric type.
The C++ Standard Library itself relies heavily on class templates. Containers like vector and map (also introduced in CPP98 in the year 1998) are all class templates. By learning to write your own class templates, you can better understand how these standard containers work.
class template syntax can be tricky at first, but once you get used to it, you will find it straightforward. For example, you write template<typename T> before your class definition and then use T as if it were a type inside the class body.
class templates provide what is called parametric polymorphism. Instead of runtime polymorphism based on virtual functions, templates handle different types at compile time, generating specialized code for each type parameter.
Because template code is processed at compile time, the CPP compiler can catch type-related errors early. You don’t need to run the program to see if a type mismatch occurs; the compiler will alert you as soon as it sees invalid template usage.
class templates can also use non-type parameters, such as integers. For example, you could write a Grid<T, Width, Height> that fixes the dimensions of the grid at compile time, creating a more optimized structure for certain use cases.
The main strength of class templates is reusability. You write your code once and apply it to many types. This eliminates writing the same logic over and over again for slightly different data types.
If the syntax or concepts seem overwhelming, it helps to start with a small example. Write a simple class template that just stores one CPP object, and then gradually add features, like arrays or more complex methods.
When you compare a polymorphic solution to a class template solution, you’ll often find that class templates are simpler and more efficient for general-purpose containers. Polymorphism is still useful for certain scenarios, but templates shine when the type can be known at compile time.
Unlike polymorphic solutions, class templates do not require runtime checks or a virtual table. The CPP compiler generates code tailored to the given types, resulting in efficient, direct calls and memory accesses.
Templates, including class templates, are everywhere in modern CPP code. Understanding how to write and use them is essential for working effectively with libraries, frameworks, and the C++ Standard Library.
As language standards evolve, like CPP23 (introduced in the year 2023) adding multidimensional subscripting, class templates remain central. Learning them now prepares you for leveraging new features and writing advanced, type-safe code in the future.
By practicing writing class templates and using them in various contexts, you’ll gain confidence. Eventually, templates will feel like a natural tool in your programming toolbox, enabling you to tackle complex problems with elegant solutions.
Every professional CPP programmer must understand class templates because they are a fundamental feature of the language. Even if you do not write your own templates often, you will use them daily through standard containers and other libraries.
Class templates give you the power to write code that is type-independent, flexible, and efficient. They build upon familiar concepts, extend them to work with arbitrary types, and form a cornerstone of modern CPP programming practice.
Introduced in CPP98, CPP Templates enable generic programming by allowing the creation of functions and classes that work with various data types. A template uses type parameters, making the code reusable and reducing duplication.
CPP Templates power features like the Standard Template Library (STL), enabling data structure implementations such as vectors, lists, and maps. They support template specialization and template metaprogramming, making them central to modern CPP development.
https://en.cppreference.com/w/cpp/language/templates
Templates are a feature of the C++ programming language that allows functions and classes to operate with generic types. This allows a function or class declaration to reference via a generic variable another different class (built-in or newly declared data type) without creating full declaration for each of these different classes.
In plain terms, a templated class or function would be the equivalent of (before "compiling") copying and pasting the templated block of code where it is used, and then replacing the template parameter with the actual one. For this reason, classes employing templated methods place the implementation in the headers (*.h files) as no symbol could be compiled without knowing the type beforehand.
The C++ Standard Library provides many useful functions within a framework of connected templates.
Major inspirations for C++ templates were the parameterized modules provided by the language CLU and the generics provided by Ada.
Return to Tour of C Plus Plus, 3rd Edition by Bjarne Stroustrup | Tour of C++, 3rd Edition by Bjarne Stroustrup, C Plus Plus Fundamentals | C++ Fundamentals, C Plus Plus Bibliography | C++ Bibliography, C Plus Plus | C++, C Plus Plus DevOps | C++ DevOps - C Plus Plus SRE | C++ SRE - C Plus Plus CI/CD | C++ CI/CD, Cloud Native C Plus Plus | Cloud Native C++ - C Plus Plus Microservices | C++ Microservices - Serverless C Plus Plus | Serverless C++, C Plus Plus Security | C++ Security - C Plus Plus DevSecOps | C++ DevSecOps, Functional C Plus Plus | Functional C++, C Plus Plus Concurrency | C++ Concurrency, C Plus Plus Data Science | C++ Data Science - C Plus Plus and Databases | C++ and Databases, C Plus Plus Machine Learning | C++ Machine Learning, C Plus Plus Courses | C++ Courses, C Plus Plus Glossary | C++ Glossary, Awesome C Plus Plus | Awesome C++, C Plus Plus GitHub | C++ GitHub, C Plus Plus Topics | C++ Topics
CPP Templates | C++ Templates: Templates, CPP Templating, CPP Generic Programming, Generic Programming, Generics, CPP Concepts, CPP Templates. (navbar_cpp_templates - see also navbar_cpp_generics, navbar_cpp_concepts)
CPP Generics | C++ Generics: CPP Generic Programming, Generic Programming, Generics, Function Overloading (Defining multiple functions with the same name is an essential part of generic programming), CPP Concepts, CPP Templates. (navbar_cpp_generics - see also navbar_cpp_templates, navbar_cpp_concepts, navbar_generics)
CPP Concepts | C++ Concepts: Concepts, CPP Generic Programming, Generic Programming, CPP Generics, CPP Templates. (navbar_cpp_concepts - see also navbar_cpp_generics, navbar_cpp_templates)
CPP ABI (Application Binary Interface), CPP ABO (Asymmetric Binary Operation) , CPP Abstract Base Class, CPP Access Specifier, CPP Accumulate Algorithm, CPP Adapter Class, CPP Adaptive Composite Pattern, CPP Address Sanitizer, CPP Aggregate Initialization, CPP Aggregation Relationship, CPP Alignment Requirement, CPP Aligned Allocation, CPP Aligned Deallocation, CPP Aligned Storage, CPP Alignment-Support Types, CPP Allocator Adaptor, CPP Allocator Requirement, CPP Allocator-Aware Container, CPP Allocator-Extended Constructor, CPP Allocator-Extended Move Constructor, CPP Allocator-Extended Swap, CPP Allocation Function, CPP Allowable Exception Specification, CPP ALPHA Conversion (Renaming of Bound Variables), CPP Alternative Token, CPP Analysis-Based Optimization, CPP And Keyword, CPP And_Eq Keyword, CPP Angle Bracket Inclusion, CPP Anonymous Namespace, CPP Anti-Unification, CPP API Bindings for [[CPP Libraries]], CPP Argument Dependent Lookup, CPP Argument Pack, CPP Argument Unpacking, CPP Array Decay, CPP Array New Expression, CPP Array-Bound Safe Function, CPP Array-To-Pointer Conversion, CPP Articulated Lvalues, CPP Artificial Dependency Injection, CPP Artificial Instantiation, CPP Assert Macro, CPP Assigned-To Null Pointer Check, CPP AST (Abstract Syntax Tree), CPP AsIf Rule, CPP ASM Keyword, CPP Associated Type, CPP Assumption Hints, CPP Asynchronous Exception, CPP Atomic Compare-And-Exchange Operation, CPP Atomic Constraint, CPP Atomic Flag, CPP Atomic Operations Library, CPP Atomic Relaxed Operation, CPP Atomic Release-Acquire Operation, CPP Atomic Signal Fence, CPP Atomic Strong Compare Exchange, CPP Atomic Weak Compare Exchange, CPP Attribute Namespace, CPP Attribute Syntax, CPP Audit Keyword, CPP Auto Keyword, CPP Automatic Storage Duration, CPP Awaitable Type, CPP Background Thread in [[CPP]], CPP Back-Inserter Iterator, CPP Back-Inserter Iterator Adapter, CPP Backtrace Support, CPP Balanced Binary Tree In [[CPP]], CPP Bandwidth Optimization in [[CPP]], CPP Base Class Subobject, CPP Basic Exception Guarantee, CPP Basic Guarantee, CPP Basic Iostream, CPP Basic IOS, CPP Basic Istream, CPP Basic Ostream, CPP Basic Streambuf, CPP Begin Iterator, CPP Bessel Functions, CPP Bidir Iterator Category, CPP Bidirectional Iterator, CPP Big-O Notation in [[CPP Context]], CPP Binary Compatibility, CPP Binary Literal, CPP Binary Search Algorithm, CPP Binary Tree Implementation Detail, CPP Binding Pattern, CPP Bit Mask Operation, CPP Bit Shift Operation, CPP Bitand Keyword, CPP Bitfield Implementation, CPP Bitor Keyword, CPP Bitset Class, CPP Bitwise Complement, CPP Bitwise Operator Overload, CPP Block Scope, CPP Blocking Function Call, CPP Blocking I/O in [[CPP]], CPP Boilerplate Code Generation, CPP Bool Keyword, CPP Boolean Literal, CPP Brace Initialization, CPP Braced-Init-List, CPP Break Keyword, CPP Bridge Pattern in [[CPP]], CPP Built-In Type, CPP Built-In Function, CPP Built-In Operator, CPP Bundled Header Units, CPP Byte-Wise Operations, CPP Call Once Function, CPP Call Operator, CPP Callable Object, CPP Candidate Function, CPP Capacity Member Function, CPP Capturing Lambda, CPP Case Keyword, CPP Casting Operator Overload, CPP CDECL Calling Convention, CPP CeePlusPlus Language Linkage, CPP Character Literal, CPP Char16_T Keyword, CPP Char32_T Keyword, CPP Char Keyword, CPP Checked Iterators, CPP Chi-Squared Distribution, CPP Circular Buffer Implementation, CPP Class Key, CPP Class Member, CPP Class Scope, CPP Class Template, CPP Class Template Argument Deduction, CPP Class-Scoped Enumeration, CPP Cleanup Function, CPP Client-Side Abstraction, CPP Clocale Header, CPP Close Function for Streams, CPP Code Bloat Minimization, CPP Code Gen Optimization, CPP Code Generation Rule, CPP Code Smell Detection, CPP CoAwait Keyword, CPP CoReturn Keyword, CPP CoYield Keyword, CPP Collateral Class Template Instantiation, CPP Common Reference, CPP Common Type, CPP Compact Exception Model, CPP Compilation Firewalls, CPP Compilation Unit, CPP Complete Object, CPP Complex Number Type, CPP Compound Assignment Operator, CPP Compound Literal, CPP Compound Requirement, CPP Concept Keyword, CPP Concept Map, CPP Concept Predicate, CPP Concrete Type, CPP Conditional Explicit, CPP Conditional Inference, CPP Conditional Operator, CPP Conditional Variable, CPP Conforming Implementation, CPP Conformed Specialization, CPP Conformance Level, CPP Conformance Test Suite, CPP Conjunction Concept, CPP Constant Expression, CPP Constant Initialization, CPP Constant Interval Bound, CPP Const Keyword, CPP Const Member Function, CPP Const Volatile Qualifier, CPP Const_Assert Macro, CPP Consteval Keyword, CPP Constexpr Keyword, CPP Constexpr Constructor, CPP Constexpr Function, CPP Constinit Keyword, CPP Constexpr If Statement, CPP Constraint Expression, CPP Constraint Satisfaction, CPP Constraint_Based Overload Resolution, CPP Constructor Delegation, CPP Constructor Inheritance, CPP Constructor Template, CPP Contextual Conversion, CPP Continue Keyword, CPP Contract Programming, CPP Contravariant Parameter Type, CPP Conversion Function, CPP Conversion Operator, CPP Conversion Sequence, CPP Copy Assignment Operator, CPP Copy Constructor, CPP Copy Ellision, CPP Core Constant Expressions, CPP Core Guidelines, CPP Coroutine Frame, CPP Coroutine Handle, CPP Coroutine State Machine, CPP Coroutine Suspension, CPP Count Algorithm, CPP Covariant Return Type, CPP CRTP (Curiously Recurring Template Pattern), CPP CTAD (Class Template Argument Deduction), CPP CUDA Extensions For [[CPP]], CPP Curly Brace Scope, CPP Custom Deleter in Smart Pointer, CPP Custom Exception, CPP Custom Literal Suffix, CPP Dangling Pointer Detection, CPP Dangling Reference, CPP Data Member Alignment, CPP Data Member Padding, CPP Data Race, CPP Data Segment, CPP Debug Macro, CPP Debug Symbol, CPP Decay Type, CPP Decltype Keyword, CPP Decomposition Declaration, CPP Deduction Guide, CPP Deep Copy, CPP Default Argument, CPP Default Capture, CPP Default Constructor, CPP Default Initialization, CPP Default Member Initializer, CPP Defaulted Function, CPP Defaulted Move Constructor, CPP Deleted Function, CPP Deleter Object, CPP Deletion Overload, CPP Demangled Name, CPP Dependent Base, CPP Dependent Name, CPP Dependent Scope, CPP Dependent Type, CPP Dependent Type Name, CPP Deprecated Attribute, CPP Design Pattern Application, CPP Designated Initializer, CPP Destructor, CPP Device Code in [[CPP Offloading]], CPP Diagnostic Message, CPP Digit Separator, CPP Direct Base Class, CPP Direct Initialization, CPP Directive, CPP Discard Block, CPP Discard Statement, CPP Disjunction Concept, CPP DLL Export, CPP DLL Import, CPP Do Keyword, CPP Do-While Loop, CPP Documented Behavior, CPP Dominance Analysis, CPP Double Keyword, CPP Downcast Operation, CPP Downward Closure, CPP DRY Principle in [[CPP]], CPP Dynamic Allocation, CPP Dynamic Cast Keyword, CPP Dynamic Exception Specification, CPP Dynamic Initialization, CPP Dynamic Linkage, CPP Dynamic Polymorphism, CPP Dynamic Type, CPP Eager Instantiation, CPP EBCDIC Support, CPP Effective Modern [[CPP Book Reference]], CPP Ellipsis Parameter, CPP Empty Base Optimization, CPP Empty Class, CPP Empty Parameter Pack, CPP Enable If Utility, CPP End Iterator, CPP End Of File State, CPP Endl Manipulator, CPP Enumeration Underlying Type, CPP Enumerator, CPP Enum Keyword, CPP Equality Operator, CPP Equivalence Relation, CPP Erased Type, CPP Error Handling Strategy, CPP Error State Indicator, CPP Exception Filter, CPP Exception Guarantee, CPP Exception Handling, CPP Exception Object, CPP Exception Safe Functions, CPP Exception Specification, CPP Exception Translation, CPP Execinfo Integration, CPP Execution Character Set, CPP Execution Policy, CPP Exhaustive Instantiation, CPP Explicit Conversion Operator, CPP Explicit Keyword, CPP Export Keyword, CPP Extern Keyword, CPP External Linkage, CPP External Template, CPP ExternC Linkage, CPP Face-Deletion Operator, CPP False Keyword, CPP Fast Floating-Point Mode, CPP Field Alignment, CPP File Scope, CPP Filebuf Class, CPP Filesystem Directory Iterator, CPP Filesystem Path, CPP Final Specifier, CPP Fixed-Size Array, CPP Fixed-Width Integer, CPP Floating Point Environment, CPP Floating Point Literal, CPP Fold Expression, CPP For Keyword, CPP For Range Loop, CPP Forward Declaration, CPP Forward Iterator, CPP Forward List, CPP Forwarding Reference, CPP Four-Phase Name Lookup, CPP Friend Class, CPP Friend Declaration, CPP Friend Function, CPP Front Insertion Operator, CPP Full Expression, CPP Full Specialization, CPP Function Adapter, CPP Function Call Operator, CPP Function-Like Macro, CPP Function Object, CPP Function Overload, CPP Function Parameter Pack, CPP Function Pointer, CPP Function Template, CPP Function Template Partial Specialization, CPP Function Template Specialization, CPP Garbage Collection Interface, CPP Gcc Extension For [[CPP]], CPP Generalized Constant Expression, CPP Generic Lambda, CPP Generic Programming, CPP Getline Function, CPP Global New Operator, CPP Global Namespace, CPP Global Object, CPP Global Variable, CPP GPU Offloading Support, CPP Greater Comparator, CPP Guaranteed Copy Elision, CPP Guarded Suspension, CPP Half-Open Interval in Iterators, CPP Handler Block, CPP Has Include Preprocessor, CPP Hash Function Object, CPP Heap Allocation, CPP Heuristic Inline, CPP Hidden Friend Idiom, CPP Hidden Implementation Detail, CPP Homogeneous Function Template, CPP Hook Function, CPP I/O Manipulator, CPP I/O State Flag, CPP I/O Stream Buffer, CPP I/O Stream Iterator, CPP If Constexpr, CPP If Keyword, CPP If-Else Chain, CPP Ill-Formed Program, CPP Immediate Function, CPP Implementation-Defined Behavior, CPP Implementation Limit, CPP Import Keyword, CPP Incremental Compilation, CPP Indeterminate Value, CPP Index Sequence, CPP Indirect Call Optimization, CPP Inheritance Chain, CPP Inherited Constructor, CPP Inline Assembly, CPP Inline Keyword, CPP Inline Namespace, CPP Inline Variable, CPP Input Iterator, CPP Integral Constant Expression, CPP Integral Promotion, CPP Integer Division, CPP Integer Literal, CPP Internal Linkage, CPP Intrinsic Function, CPP Invalid Pointer, CPP Invocation Operator, CPP IOS Base, CPP IOS Flags, CPP IOS Format State, CPP IOS Precision, CPP IOS Width, CPP Iostream Synchronization, CPP IPC Mechanisms in [[CPP (Non-OS Generic)]], CPP ISO Standard Committee, CPP IsLiteralType Trait, CPP Iteration Statement, CPP Iterator Adapter, CPP Iterator Category, CPP Iterator Invalidation, CPP Iterator Traits, CPP JIT Compilation for [[CPP]], CPP Just-In-Time Debugging, CPP Key Function, CPP Keyword Recognition, CPP Koenig Lookup, CPP Label Declaration, CPP Lambda Capture, CPP Lambda Closure Type, CPP Lambda Expression, CPP Lambda Introducer, CPP Lambda Object, CPP Language Linkage, CPP Late Template Parsing, CPP Lexical Block, CPP LIFO Semantics, CPP Lifetime Extension of Temporaries, CPP Lifetime Profile, CPP Limit Macro, CPP Link Time Optimization, CPP Linker Script Interaction with [[CPP Symbols]], CPP Linker-Aided Optimization, CPP Linktime Polymorphism, CPP Literal Operator, CPP Literal Suffix, CPP Literal Type, CPP Local Class, CPP Local Static Variable, CPP Lock Guard, CPP Lock-Free Programming, CPP Logic And Operator, CPP Logic Not Operator, CPP Logic Or Operator, CPP Logical Conjunction, CPP Logical Disjunction, CPP Long Double Keyword, CPP Long Keyword, CPP Lookup Rule, CPP Loophole Casting, CPP Low-Level Memory Intrinsics, CPP Lvalue Reference, CPP Lvalue Transformation, CPP Machine Code Generation for [[CPP]], CPP Magic Statics, CPP Magnitude Type, CPP Main Function, CPP Make Shared, CPP Make Unique, CPP Mangling, CPP Map Container, CPP Masked Operation, CPP Maximum Munch Rule, CPP Memento Pattern in [[CPP]], CPP Member Access Operator, CPP Member Initializer List, CPP Member Template, CPP Member Variable Template, CPP Memory Fence, CPP Memory Model, CPP Memory Order, CPP Memory Resource, CPP Metaclasses Proposal, CPP Metaobject Facility, CPP Metaprogramming, CPP MinGW Toolchain, CPP Minimal Perfect Forwarding, CPP Modified UTF-8 Strings in [[CPP Context]], CPP Module Interface Unit, CPP Module Partition, CPP Module Purview, CPP Module Unit, CPP Module-Mapper, CPP Modules TS, CPP Move Assignment Operator, CPP Move Constructor, CPP Move Iterator, CPP Move Semantics, CPP MSVC Extensions, CPP Multiple Inheritance, CPP Multiway Merge, CPP Mutable Keyword, CPP Mutable Lambda, CPP Name Hiding, CPP Name Lookup, CPP Named Requirement, CPP Narrow Character Type, CPP Narrowing Conversion, CPP Namespace Alias, CPP Namespace Keyword, CPP Natvis Debug Visualization, CPP Nested Class, CPP Nested Exception, CPP Nested Lambda, CPP Nested Namespace, CPP Nested Template, CPP New Expression, CPP Nibble Access in Bitset, CPP No Except Keyword, CPP No Return Function, CPP No Unique Address Attribute, CPP Noop Mutex, CPP Normative Reference in Standard, CPP Not Keyword, CPP Not_Eq Keyword, CPP noexcept Operator, CPP Nothrow Guarantee, CPP Null Pointer Constant, CPP Nullptr Keyword, CPP Number Literal, CPP Numeric Limit, CPP ODR (One-Definition Rule), CPP ODR-Use, CPP Opaque Enum Declaration, CPP Open Multi-Methods in [[CPP (Visitor Pattern)]], CPP Operator Delete, CPP Operator Delete[], CPP Operator Function Id, CPP Operator New, CPP Operator New[], CPP Operator Overload, CPP Optional Class Template, CPP Order Statistics Tree (Extension), CPP Ordered Comparison, CPP Ordered Map, CPP Ordered Set, CPP Ordering Category, CPP Ostream Iterator, CPP Out Of Line Definition, CPP Out Parameter Style, CPP Out-Of-Class Member Definition, CPP Output Iterator, CPP Over Alignment Support, CPP Overload Resolution, CPP Overloaded Operator, CPP Overloaded Template, CPP Overriding Function, CPP Package Manager for [[CPP Libraries]], CPP Pair Class Template, CPP Panic Mode Recovery in Parser, CPP Parameter Pack, CPP Parameter Pack Expansion, CPP Parent Class, CPP Partial Ordering of Function Templates, CPP Partial Specialization, CPP Perfect Forwarding, CPP PH (Placeholders) In Templates, CPP Placement Delete, CPP Placement New, CPP Plain Old Data (POD) Type, CPP Pmr Allocator, CPP Pointer Arithmetic, CPP Pointer Decay, CPP Pointer Interconvertibility, CPP Pointer To Member, CPP Polymorphic Allocator, CPP Polymorphic Class, CPP Polymorphic Lambda, CPP Polymorphic Type, CPP Postfix Decrement Operator, CPP Postfix Increment Operator, CPP Precompiled Header, CPP Predefined Macro, CPP Prefix Decrement Operator, CPP Prefix Increment Operator, CPP Preprocessing Directive, CPP Private Base, CPP Private Inheritance, CPP Protected Inheritance, CPP Public Inheritance, CPP Pure Virtual Function, CPP Qualifier Adjustment, CPP Qualified Id, CPP Qualified Lookup, CPP Qualified Name Lookup, CPP Quick_Exit Function, CPP RAII (Resource Acquisition Is Initialization), CPP Random Device, CPP Range Based For Loop, CPP Range Concept, CPP Range-V3 Library Integration, CPP Raw String Literal, CPP Realloc Function Avoidance, CPP Rebind Allocator, CPP Recursion Limit, CPP Redundant Move, CPP Reference Collapsing Rules, CPP Reference Parameter, CPP Reference Wrapper, CPP Reflexpr Keyword, CPP Register Keyword, CPP Regular Type Concept, CPP Reinterpret_Cast Keyword, CPP Relaxed Constraint, CPP Release Mode, CPP Requires Clause, CPP Requires Expression, CPP Requires Keyword, CPP Requirement Body, CPP Requirement Parameter, CPP Resource Leak Detection, CPP Resource Management, CPP Restricted Aliasing, CPP Return Keyword, CPP Return Type Deduction, CPP Reverse Iterator, CPP RIAA (Reverse RAII Approach, Hypothetical), CPP Ring Buffer, CPP RNG (Random Number Generator) Expanded As Random Number Generator, CPP Rule Of Five, CPP Rule Of Three, CPP Runtime Polymorphism, CPP Runtime Type Information, CPP Safe Bool Idiom, CPP Sampling Distribution Function, CPP Sanitizer, CPP Sargable Expression in [[CPP (Hypothetical Term)]], CPP Scalar Replacement of Aggregates, CPP Scenario Testing in [[CPP Unit Tests]], CPP Scope Guard Idiom, CPP Scope Resolution Operator, CPP Scoped Enumeration, CPP Scoped Lock, CPP Scoped Thread, CPP Secondary Template, CPP Segmentation Fault Handling, CPP Selection Statement, CPP Semaphore, CPP Sequence Container, CPP Shallow Copy, CPP Shared Future, CPP Shared Lock, CPP Shared Mutex, CPP Shared Pointer, CPP Short Circuit Evaluation, CPP Short Keyword, CPP Signed Integer Type, CPP Signature (Function), CPP Silent Conversion, CPP Simple Declaration, CPP Single Inheritance, CPP Single Module Unit, CPP Singleton Pattern in [[CPP]], CPP Sized Deallocation, CPP Sized Deallocation Function, CPP Slicing Problem, CPP Slice Array, CPP Smart Pointer, CPP Snowflake Operator (Hypothetical Term), CPP Software Transactional Memory Proposal, CPP Source Code Transformation, CPP Spacer Iterator (Hypothetical Term), CPP Special Member Function, CPP Specialization, CPP SFINAE (Substitution Failure Is Not An Error), CPP Shift Left Operator Overload, CPP Shift Right Operator Overload, CPP Short Lived Object Optimization, CPP Signed Char Type, CPP Signal Handler Invocation, CPP Signature of a Callable, CPP Silent Failure In Templates, CPP Sized Array To Pointer Decay, CPP Slice Iterator (Hypothetical Term), CPP Small Buffer Optimization, CPP Sort Algorithm, CPP Sorting Network Implementation, CPP Source Code Translation Unit, CPP Specialized Allocator, CPP Speculative Load, CPP Spin Lock Implementation, CPP Spurious Wakeup Prevention, CPP SSO (Small String Optimization), CPP Stable Partition, CPP Stack Allocation, CPP Standard Algorithm, CPP Standard Atomic, CPP Standard Backward Compatibility, CPP Standard Basic_String, CPP Standard Bitset, CPP Standard Byte Type, CPP Standard Charconv, CPP Standard Chrono, CPP Standard Codecvt, CPP Standard Compare, CPP Standard Concurrency Support, CPP Standard Condition_Variable, CPP Standard Container Adaptors, CPP Standard Container Erasure, CPP Standard Container Invalidation Rules, CPP Standard Deque, CPP Standard Duration, CPP Standard Dynamic Extent, CPP Standard Execution Policy, CPP Standard Filesystem, CPP Standard Fixed Size Array, CPP Standard Forward_List, CPP Standard Fstream, CPP Standard Function, CPP Standard Future, CPP Standard Hash, CPP Standard Iomanip, CPP Standard Ios, CPP Standard Iostream, CPP Standard Iostream Synchronization, CPP Standard Istream, CPP Standard Iterator, CPP Standard Layout Type, CPP Standard Library, CPP Standard List, CPP Standard Locale, CPP Standard Map, CPP Standard Memory, CPP Standard MultiMap, CPP Standard MultiSet, CPP Standard Mutex, CPP Standard Optional, CPP Standard Ostream, CPP Standard Pair, CPP Standard Priority_Queue, CPP Standard Promise, CPP Standard Queue, CPP Standard Random, CPP Standard Ratio, CPP Standard Raw Storage Iterator, CPP Standard Regex, CPP Standard Relaxed Iterator Concept, CPP Standard Scoped_Allocator_Adaptor, CPP Standard Set, CPP Standard Shared_Future, CPP Standard Shared_Ptr, CPP Standard Span, CPP Standard Stack, CPP Standard Streambuf, CPP Standard String, CPP Standard String_View, CPP Standard System_Error, CPP Standard Template Library (STL), CPP Standard Thread, CPP Standard Tuple, CPP Standard Type Erasure, CPP Standard Type Traits, CPP Standard Unique_Lock, CPP Standard Unique_Ptr, CPP Standard Unordered_Map, CPP Standard Unordered_Multimap, CPP Standard Unordered_Multiset, CPP Standard Unordered_Set, CPP Standard Utility, CPP Standard Valarray, CPP Standard Variant, CPP Standard Vector, CPP Static_assert Keyword, CPP Static Keyword, CPP Static Allocation, CPP Static Cast Keyword, CPP Static Data Member, CPP Static Storage Duration, CPP Storage Class Specifier, CPP Strict Aliasing Rule, CPP String Literal, CPP Stringification Macro, CPP Strong Exception Guarantee, CPP Structured Binding, CPP Subobject, CPP Substitution Failure, CPP Synchronized Pool Resource, CPP Synchronization Primitives, CPP Syntactic Category, CPP SzArray (Hypothetical Term), CPP Template Argument Deduction, CPP Template Class, CPP Template Constrained Function, CPP Template Friend, CPP Template Instantiation, CPP Template Metaprogramming, CPP Template Parameter, CPP Template Parameter Pack Expansion, CPP Template Partial Specialization, CPP Template Specialization, CPP Temporary Materialization, CPP Ternary Operator, CPP This Keyword, CPP Thread Local Keyword, CPP Thread Safe Initialization, CPP Three Way Comparison Operator, CPP Throw Expression, CPP Throw Keyword, CPP Token Concatenation, CPP Token Pasting Operator, CPP Traits Class, CPP Trampoline Function Technique, CPP Translation Unit, CPP Trigraph Sequence, CPP Trivial Class, CPP Trivial Type, CPP True Keyword, CPP Try Keyword, CPP TU (Translation Unit) Expanded As Translation Unit, CPP Type Alias, CPP Type Alias Template, CPP Type Deduction, CPP Type Erasure Idiom, CPP Type Id Expression, CPP Type Parameter Pack, CPP Type Promotion, CPP Type Safe Union, CPP Type Trait, CPP Type Transformation, CPP Type_Safe Enum Idiom, CPP Typename Keyword, CPP Underlying Type, CPP Unicode Literal, CPP Union Keyword, CPP Union Member, CPP Unique Address Optimization, CPP Uninitialized Fill, CPP Uninitialized Memory, CPP Uninitialized Value, CPP Universal Reference, CPP Unnamed Namespace, CPP Unordered Container, CPP Unreachable Code, CPP Unsigned Integer Type, CPP Utility Forward, CPP Value Category, CPP Value Initialization, CPP Variable Template, CPP Variadic Macro, CPP Variadic Template, CPP Vectorization Strategies, CPP Virtual Base Class, CPP Virtual Dispatch, CPP Virtual Function Table (VFT), CPP Virtual Function, CPP Virtual Inheritance, CPP Visible Entity, CPP Visibility Attribute, CPP Volatile Keyword, CPP Wchar_T Keyword, CPP Weak Symbol, CPP Wide Character Literal, CPP Wide String Literal, CPP Wide-Char Stream, CPP Widen Function, CPP Widening Conversion, CPP Working Draft of [[CPP Standard]], CPP Xor Keyword, CPP Xor_Eq Keyword, CPP Zero Initialization
C Plus Plus | C++: Effective CPP | Effective C++, C Plus Plus Best Practices | C++ Best Practices, CPP Core Guidelines (CG) by Bjarne Stroustrup and Herb Sutter | C++ Core Guidelines (CG) by Bjarne Stroustrup and Herb Sutter, C Plus Plus Fundamentals | C++ Fundamentals, C Plus Plus Inventor | C++ Inventor - C Plus Plus Language Designer | C++ Language Designer: Bjarne Stroustrup in 1985; C Plus Plus Keywords | C++ Keywords, CPP Built-In Data Types | C++ Built-In Data Types, C Plus Plus Data Structures | C++ Data Structures (CPP Containers) - C Plus Plus Algorithms | C++ Algorithms, C Plus Plus Syntax | C++ Syntax, C Plus Plus OOP | C++ OOP - C Plus Plus Design Patterns | C++ Design Patterns, Clean C Plus Plus | Clean C++ - C Plus Plus Style Guide | C++ Style Guide - C Plus Plus BDD | C++ BDD, C Plus Plus Standards | C++ Standards (C Plus Plus 23 | C++ 23, C Plus Plus 20 | C++ 20, C Plus Plus 17 | C++ 17, C Plus Plus 14 | C++ 14, C Plus Plus 11 | C++ 11, C Plus Plus 03 | C++ 03, C Plus Plus 98 | C++ 98), Bjarne Stroustrup's C Plus Plus Glossary | Bjarne Stroustrup's C++ Glossary - Glossaire de CCP - French, CppReference.com, CPlusPlus.com, ISOcpp.org, C Plus Plus Compilers | C++ Compilers (Compiler Explorer, MinGW), C Plus Plus IDEs | C++ IDEs, C Plus Plus Development Tools | C++ Development Tools, C Plus Plus Linter | C++ Linter, C Plus Plus Debugging | C++ Debugging, C Plus Plus Modules | C++ Modules (C Plus Plus 20 | C++20), C Plus Plus Packages | C++ Packages, C Plus Plus Package Manager | C++ Package Manager (Conan - the C/C Plus Plus Package Manager | Conan - the C/C++ Package Manager), C Plus Plus Standard Library | C++ Standard Library, C Plus Plus Libraries | C++ Libraries, C Plus Plus Frameworks | C++ Frameworks, C Plus Plus DevOps | C++ DevOps - C Plus Plus SRE | C++ SRE, C Plus Plus CI/CD | C++ CI/CD (C Plus Plus Build Pipeline | C++ Build Pipeline), C Plus Plus Data Science | C++ Data Science - C Plus Plus DataOps | C++ DataOps, C Plus Plus Machine Learning | C++ Machine Learning, C Plus Plus Deep Learning | C++ Deep Learning, Functional C Plus Plus | Functional C++, C Plus Plus Concurrency | C++ Concurrency, C Plus Plus History | C++ History, C Plus Plus Topics | C++ Topics, C Plus Plus Bibliography | C++ Bibliography, Manning CPP Series | Manning C++ Series, C Plus Plus Courses | C++ Courses, CppCon, C Plus Plus Research | C++ Research, C Plus Plus GitHub | C++ GitHub, Written in C Plus Plus | Written in C++, C Plus Plus Popularity | C++ Popularity, C Plus Plus Awesome | C++ Awesome, C Plus Plus Versions | C++ Versions. (navbar_cplusplus – see also navbar_cpp_containers, navbar_cppcon, navbar_cpp_core_guidelines, navbar_cpp23, navbar_cpp20, navbar_cpp17, navbar_cpp14, navbar_cpp11)
Cloud Monk is Retired ( for now). Buddha with you. © 2025 and Beginningless Time - Present Moment - Three Times: The Buddhas or Fair Use. Disclaimers
SYI LU SENG E MU CHYWE YE. NAN. WEI LA YE. WEI LA YE. SA WA HE.