Named requirements
From cppreference.com
< cpp
The named requirements 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.
Some of these requirements are being formalized in C++20 using the concepts language feature. 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 | |
specifies that an object of the type can be default constructed (named requirement) | |
(C++11) |
specifies that an object of the type can be constructed from rvalue (named requirement) |
specifies that an object of the type can be constructed from lvalue (named requirement) | |
(C++11) |
specifies that an object of the type can be assigned from rvalue (named requirement) |
specifies that an object of the type can be assigned from lvalue (named requirement) | |
specifies that an object of the type can be destroyed (named requirement) | |
Layout | |
Note: the standard does not define named requirements with names specified in this subcategory. These are type categories defined by the core language. They are included here as named requirements only for consistency. | |
(C++11) |
class with trivial copy, assignment and destructor (named requirement) |
(C++11) |
class with trivial constructors, assignment and destructor (named requirement) |
(C++11) |
non-virtual class containing only other StandardLayout members, all with the same access control (named requirement) |
POD (Plain Old Data) structure, compatible with C struct (named requirement) | |
Library-wide | |
operator== is an equivalence relation (named requirement) | |
operator< is a strict weak ordering relation (named requirement) | |
(C++11) |
can be swapped with an unqualified non-member function call swap() (named requirement) |
(C++11) |
an LegacyIterator that dereferences to a Swappable type (named requirement) |
(C++11) |
a pointer-like type supporting a null value (named requirement) |
(C++11) |
a FunctionObject that for inputs with different values has a low probability of giving the same output (named requirement) |
a class type that contains allocation information (named requirement) | |
an object that can be called with the function call syntax (named requirement) | |
a type for which the invoke operation is defined (named requirement) | |
a FunctionObject that returns a value convertible to bool for one argument without modifying it (named requirement) | |
a FunctionObject that returns a value convertible to bool for two arguments without modifying them (named requirement) | |
a BinaryPredicate that establishes an ordering relation (named requirement) |
Container | |
data structure that allows element access using iterators (named requirement) | |
container using bidirectional iterators (named requirement) | |
(C++11) |
container using an allocator (named requirement) |
container with elements stored linearly (named requirement) | |
(C++17) |
container with elements stored at adjacent memory addresses (named requirement) |
container that stores elements by associating them to keys (named requirement) | |
container that stores elements stored in buckets by associating them to keys (named requirement) | |
Container element | |
(C++11) |
element can be default-constructed in uninitialized storage (named requirement) |
(C++11) |
element can be copy-constructed in uninitialized storage (named requirement) |
(C++11) |
element can be move-constructed in uninitialized storage (named requirement) |
(C++11) |
element can be constructed in uninitialized storage (named requirement) |
(C++11) |
element can be destroyed using an allocator (named requirement) |
Iterator | |
general concept to access data within some data structure (named requirement) | |
iterator that can be used to read data (named requirement) | |
iterator that can be used to write data (named requirement) | |
iterator that can be used to read data multiple times (named requirement) | |
iterator that can be both incremented and decremented (named requirement) | |
iterator that can be advanced in constant time (named requirement) | |
(C++17) |
iterator to contiguously-allocated elements (named requirement) |
(C++20) |
iterator that can be used during constant expression evaluation (named requirement) |
Stream I/O functions | |
a stream input function that does not skip leading whitespace and counts the processed characters (named requirement) | |
a stream input function that skips leading whitespace (named requirement) | |
a basic stream output function (named requirement) | |
a stream output function that sets failbit on errors and returns a reference to the stream (named requirement) | |
Random Number Generation | |
(C++11) |
consumes a sequence of integers and produces a sequence of 32-bit unsigned values (named requirement) |
(C++11) |
returns uniformly distributed random unsigned integers (named requirement) |
(C++11) |
a deterministic UniformRandomBitGenerator, defined by the seed (named requirement) |
(C++11) |
a RandomNumberEngine that transforms the output of another RandomNumberEngine (named requirement) |
(C++11) |
returns random numbers distributed according to a given mathematical probability density function (named requirement) |
Concurrency | |
(C++11) |
provides exclusive ownership semantics for execution agents (i.e. threads) (named requirement) |
(C++11) |
a BasicLockable that supports attempted lock acquisition (named requirement) |
(C++11) |
a Lockable that supports timed lock acquisition (named requirement) |
(C++11) |
a Lockable that protects against data races and sequentially consistent synchronization (named requirement) |
(C++11) |
a TimedLockable that protects against data races and sequentially consistent synchronization (named requirement) |
(C++17) |
a Mutex that supports shared ownership semantics (named requirement) |
(C++14) |
a TimedMutex that supports shared ownership semantics (named requirement) |
Other | |
(C++11) |
describes a property of a type (named requirement) |
(C++11) |
describes a relationship between two types (named requirement) |
(C++11) |
modifies a property of a type (named requirement) |
(C++11) |
aggregates a duration, a time point, and a function to get the current time point (named requirement) |
(C++11) |
a Clock that does not throw exceptions (named requirement) |
defines types and functions for a character type (named requirement) | |
bitset, integer, or enumeration (named requirement) | |
a type for which initialization is effectively equal to assignment (named requirement) | |
(C++11) |
defines types and functions used by the regular expressions library (named requirement) |
(C++11) |
a type with constexpr constructor (named requirement) |
This section is incomplete Reason: Any other missing requirement? |