##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# Library Concepts

From cppreference.com
< cpp

Concept is a term that describes a named set of requirements for a type.

Formal specification of concepts (ISO/IEC TS 19217:2015) is an experimental technical specification, which makes it possible to verify that template arguments satisfy the expectations of a template or function during overload resolution and template specialization.

The library concepts listed on this page are the named requirements used in the normative text of the C++ standard to define the expectations of the standard library. These requirements are being formalized using the facilities of the above-mentioned technical specification as part of Ranges TS. It is expected that a future version of the C++ standard library will include those formal definitions. Until then, the burden is on the programmer to ensure that library templates are instantiated with template arguments that satisfy these requirements. Failure to do so may result in very complex compiler diagnostics.

### Basic
DefaultConstructible | specifies that an object of the type can be default constructed (concept)
MoveConstructible (C++11) | specifies that an object of the type can be constructed from rvalue (concept)
CopyConstructible | specifies that an object of the type can be constructed from lvalue (concept)
MoveAssignable (C++11) | specifies that an object of the type can be assigned from rvalue (concept)
CopyAssignable | specifies that an object of the type can be assigned from lvalue (concept)
Destructible | specifies that an object of the type can be destroyed (concept)
### Layout
Note, that the standard does not define named requirements or concepts with names specified in this subcategory. These are type categories defined by the core language. They are included here as concepts only for consistency.
TriviallyCopyable (C++11) | class with trivial copy, assignment and destructor (concept)
TrivialType (C++11) | class with trivial constructors, assignment and destructor (concept)
StandardLayoutType (C++11) | non-virtual class containing only other StandardLayout members, all with the same access control (concept)
PODType | POD (Plain Old Data) structure, compatible with C struct (concept)
### Library-wide
EqualityComparable | `operator==` is an equivalence relation (concept)
LessThanComparable | `operator<` is a strict weak ordering relation (concept)
Swappable (C++11) | can be swapped with an unqualified non-member function call swap() (concept)
ValueSwappable (C++11) | an `Iterator` that dereferences to a `Swappable` type (concept)
NullablePointer (C++11) | a pointer-like type supporting a null value (concept)
Hash (C++11) | a `FunctionObject` that for inputs with different values has a low probability of giving the same output (concept)
Allocator | a class type that contains allocation information (concept)
FunctionObject | an object that can be called with the function call syntax (concept)
Callable | a type for which the invoke operation is defined (concept)
Predicate | a `FunctionObject` that returns a value convertible to bool for one argument without modifying it (concept)
BinaryPredicate | a `FunctionObject` that returns a value convertible to bool for two arguments without modifying them (concept)
Compare | a `BinaryPredicate` that establishes an ordering relation (concept)

### Container
Container | data structure that allows element access using iterators (concept)
ReversibleContainer | container using bidirectional iterators (concept)
AllocatorAwareContainer (C++11) | container using an allocator (concept)
SequenceContainer | container with elements stored linearly (concept)
ContiguousContainer (C++17) | container with elements stored at adjacent memory addresses (concept)
AssociativeContainer | container that stores elements by associating them to keys (concept)
UnorderedAssociativeContainer (C++11) | container that stores elements stored in buckets by associating them to keys (concept)
##### Container element
DefaultInsertable (C++11) | element can be default-constructed in uninitialized storage (concept)
CopyInsertable (C++11) | element can be copy-constructed in uninitialized storage (concept)
MoveInsertable (C++11) | element can be move-constructed in uninitialized storage (concept)
EmplaceConstructible (C++11) | element can be constructed in uninitialized storage (concept)
Erasable (C++11) | element can be destroyed using an allocator (concept)
### Iterator
Iterator | general concept to access data within some data structure (concept)
InputIterator | iterator that can be used to read data (concept)
OutputIterator | iterator that can be used to write data (concept)
ForwardIterator | iterator that can be used to read data multiple times (concept)
BidirectionalIterator | iterator that can be both incremented and decremented (concept)
RandomAccessIterator | iterator that can be advanced in constant time (concept)
ContiguousIterator (C++17) | iterator to contiguously-allocated elements (concept)
### Stream I/O functions
UnformattedInputFunction | a stream input function that does not skip leading whitespace and counts the processed characters (concept)
FormattedInputFunction | a stream input function that skips leading whitespace (concept)
UnformattedOutputFunction | a basic stream output function (concept)
FormattedOutputFunction | a stream output function that sets failbit on errors and returns a reference to the stream (concept)
### Random Number Generation
SeedSequence (C++11) | consumes a sequence of integers and produces a sequence of 32-bit unsigned values (concept)
UniformRandomBitGenerator (C++11) | returns uniformly distributed random unsigned integers (concept)
RandomNumberEngine (C++11) | a deterministic `UniformRandomBitGenerator`, defined by the seed (concept)
RandomNumberEngineAdaptor (C++11) | a `RandomNumberEngine` that transforms the output of another `RandomNumberEngine` (concept)
RandomNumberDistribution (C++11) | returns random numbers distributed according to a given mathematical probability density function (concept)
### Concurrency
BasicLockable (C++11) | provides exclusive ownership semantics for execution agents (i.e. threads) (concept)
Lockable (C++11) | a `BasicLockable` that supports attempted lock acquisition (concept)
TimedLockable (C++11) | a `Lockable` that supports timed lock acquisition (concept)
Mutex (C++11) | a `Lockable` that protects against data races and sequentially consistent synchronization (concept)
TimedMutex (C++11) | a `TimedLockable` that protects against data races and sequentially consistent synchronization (concept)
SharedMutex (C++17) | a `Mutex` that supports shared ownership semantics (concept)
SharedTimedMutex (C++14) | a `TimedMutex` that supports shared ownership semantics (concept)
### Other
UnaryTypeTrait (C++11) | describes a property of a type (concept)
BinaryTypeTrait (C++11) | describes a relationship between two types (concept)
TransformationTrait (C++11) | modifies a property of a type (concept)
Clock (C++11) | aggregates a duration, a time point, and a function to get the current time point (concept)
TrivialClock (C++11) | a `Clock` that does not throw exceptions (concept)
CharTraits | defines types and functions for a character type (concept)
pos_type | represents a position in a stream (concept)
off_type | represents an offset in a stream (concept)
BitmaskType | bitset, integer, or enumeration (concept)
NumericType | a type for which initialization is effectively equal to assignment (concept)
RegexTraits (C++11) | defines types and functions used by the regular expressions library (concept)
LiteralType (C++11) | a type with constexpr constructor (concept)

| This section is incomplete Reason: Any other missing concept?

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/concept&oldid=88584"
Category:

- Todo with reason