# Concepts library (C++20)

From cppreference.com
< cpp

The concepts library provides definitions of fundamental library concepts that can be used to perform compile-time validation of template arguments and perform function dispatch based on properties of types. These concepts provide a foundation for equational reasoning in programs.

Most concepts in the standard library impose both syntactic and semantic requirements. In general, only the syntactic requirements can be checked by the compiler. If a semantic requirement is not met at the point of use, the program is ill-formed, no diagnostic required.

Defined in header `<concepts>`
Defined in namespace `std`

##### Core language concepts

Same (C++20) | specifies that a type is the same as another type (concept)
DerivedFrom (C++20) | specifies that a type is derived from another type (concept)
ConvertibleTo (C++20) | specifies that a type is implicitly convertible to another type (concept)
CommonReference (C++20) | specifies that two types share a common reference type (concept)
Common (C++20) | specifies that two types share a common type (concept)
Integral (C++20) | specifies that a type is an integral type (concept)
SignedIntegral (C++20) | specifies that a type is an integral type that is signed (concept)
UnsignedIntegral (C++20) | specifies that a type is an integral type that is unsigned (concept)
Assignable (C++20) | specifies that a type is assignable from another type (concept)
Swappable SwappableWith (C++20) | specifies that a type can be swapped or that two types can be swapped with each other (concept)
Destructible (C++20) | specifies that an object of the type can be destroyed (concept)
Constructible (C++20) | specifies that a variable of the type can be constructed from or bound to a set of argument types (concept)
DefaultConstructible (C++20) | specifies that an object of a type can be default constructed (concept)
MoveConstructible (C++20) | specifies that an object of a type can be move constructed (concept)
CopyConstructible (C++20) | specifies that an object of a type can be copy constructed and move constructed (concept)

##### Comparison concepts

Boolean (C++20) | specifies that a type can be used in Boolean contexts (concept)
EqualityComparable EqualityComparableWith (C++20) | specifies that operator == is an equivalence relation (concept)
StrictTotallyOrdered StrictTotallyOrderedWith (C++20) | specifies that the comparison operators on the type yield a total order (concept)

##### Object concepts

Movable (C++20) | specifies that an object of a type can be moved and swapped (concept)
Copyable (C++20) | specifies that an object of a type can be copied, moved, and swapped (concept)
Semiregular (C++20) | specifies that an object of a type can be copied, moved, swapped, and default constructed (concept)
Regular (C++20) | specifies that a type is regular, that is, it is both `Semiregular` and `EqualityComparable` (concept)

##### Callable concepts

Invocable RegularInvocable (C++20) | specifies that a callable type can be invoked with a given set of argument types (concept)
Predicate (C++20) | specifies that a callable type is a Boolean predicate (concept)
Relation (C++20) | specifies that a callable type is a binary relation (concept)
StrictWeakOrder (C++20) | specifies that a `Relation` imposes a strict weak ordering (concept)

Additional concepts can be found in the algorithms library and the ranges library.

Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/concepts&oldid=110229"