Next: , Previous: , Up: C++ Extensions   [Contents][Index]

7.10 C++ Concepts

C++ concepts provide much-improved support for generic programming. In particular, they allow the specification of constraints on template arguments. The constraints are used to extend the usual overloading and partial specialization capabilities of the language, allowing generic data structures and algorithms to be “refined” based on their properties rather than their type names.

The following keywords are reserved for concepts.


States an expression as an assumption, and if possible, verifies that the assumption is valid. For example, assume(n > 0).


Introduces an axiom definition. Axioms introduce requirements on values.


Introduces a universally quantified object in an axiom. For example, forall (int n) n + 0 == n).


Introduces a concept definition. Concepts are sets of syntactic and semantic requirements on types and their values.


Introduces constraints on template arguments or requirements for a member function of a class template.

The front end also exposes a number of internal mechanism that can be used to simplify the writing of type traits. Note that some of these traits are likely to be removed in the future.

__is_same (type1, type2)

A binary type trait: true whenever the type arguments are the same.