Difference between revisions of "cpp/named req"
m (s/concepts/library concepts, to disambig from the concepts the language feature) |
(more consistent wording) |
||
Line 15: | Line 15: | ||
{{dsc concept | cpp/concept/MoveAssignable | specifies that an object of the type can be assigned from rvalue| notes={{mark c++11}}}} | {{dsc concept | cpp/concept/MoveAssignable | specifies that an object of the type can be assigned from rvalue| notes={{mark c++11}}}} | ||
{{dsc concept | cpp/concept/CopyAssignable | specifies that an object of the type can be assigned from lvalue}} | {{dsc concept | cpp/concept/CopyAssignable | specifies that an object of the type can be assigned from lvalue}} | ||
− | {{dsc concept | cpp/concept/Destructible | specifies that type | + | {{dsc concept | cpp/concept/Destructible | specifies that an object of the type can be destroyed}} |
{{dsc h1 | Layout}} | {{dsc h1 | Layout}} | ||
− | {{dsc | Note, that the standard | + | {{dsc | Note, that the standard does not define named requirements or concepts with names specified in this subcategory. <br>These are type categories defined by the core language. They are included here as concepts only for consistency.}} |
{{dsc concept | cpp/concept/TriviallyCopyable | class with trivial copy, assignment and destructor | notes={{mark c++11}} }} | {{dsc concept | cpp/concept/TriviallyCopyable | class with trivial copy, assignment and destructor | notes={{mark c++11}} }} | ||
{{dsc concept | cpp/concept/TrivialType | class with trivial constructors, assignment and destructor | notes={{mark c++11}} }} | {{dsc concept | cpp/concept/TrivialType | class with trivial constructors, assignment and destructor | notes={{mark c++11}} }} | ||
Line 25: | Line 25: | ||
{{dsc h1 | Library-wide}} | {{dsc h1 | Library-wide}} | ||
− | {{dsc concept | cpp/concept/EqualityComparable | | + | {{dsc concept | cpp/concept/EqualityComparable | {{tt|operator{{==}}}} is an equivalence relation}} |
{{dsc concept | cpp/concept/LessThanComparable | {{tt|operator<}} is a strict weak ordering relation}} | {{dsc concept | cpp/concept/LessThanComparable | {{tt|operator<}} is a strict weak ordering relation}} | ||
{{dsc concept | cpp/concept/Swappable| can be swapped with an unqualified non-member function call {{c|swap()}} | notes={{mark c++11}} }} | {{dsc concept | cpp/concept/Swappable| can be swapped with an unqualified non-member function call {{c|swap()}} | notes={{mark c++11}} }} | ||
{{dsc concept | cpp/concept/ValueSwappable| an {{concept|Iterator}} that dereferences to a {{concept|Swappable}} type | notes={{mark c++11}} }} | {{dsc concept | cpp/concept/ValueSwappable| an {{concept|Iterator}} that dereferences to a {{concept|Swappable}} type | notes={{mark c++11}} }} | ||
− | {{dsc concept | cpp/concept/NullablePointer| pointer-like type supporting a null value | notes={{mark c++11}} }} | + | {{dsc concept | cpp/concept/NullablePointer| a pointer-like type supporting a null value | notes={{mark c++11}} }} |
{{dsc concept | cpp/concept/Hash | a {{concept|FunctionObject}} that for inputs with different values has a low probability of giving the same output | notes={{mark c++11}} }} | {{dsc concept | cpp/concept/Hash | a {{concept|FunctionObject}} that for inputs with different values has a low probability of giving the same output | notes={{mark c++11}} }} | ||
− | {{dsc concept | cpp/concept/Allocator| class type that contains allocation information}} | + | {{dsc concept | cpp/concept/Allocator| a class type that contains allocation information}} |
{{dsc concept | cpp/concept/FunctionObject | an object that can be called with the function call syntax}} | {{dsc concept | cpp/concept/FunctionObject | an object that can be called with the function call syntax}} | ||
{{dsc concept | cpp/concept/Callable | a type for which the invoke operation is defined}} | {{dsc concept | cpp/concept/Callable | a type for which the invoke operation is defined}} | ||
Line 64: | Line 64: | ||
{{dsc h1 | Stream I/O functions }} | {{dsc h1 | Stream I/O functions }} | ||
<!-- 27.7.2.3[istream.unformatted]/1 --> | <!-- 27.7.2.3[istream.unformatted]/1 --> | ||
− | {{dsc concept | cpp/concept/UnformattedInputFunction | a stream input function that | + | {{dsc concept | cpp/concept/UnformattedInputFunction | a stream input function that does not skip leading whitespace and counts the processed characters}} |
<!-- 27.7.2.2.1[istream.formatted.reqmts] --> | <!-- 27.7.2.2.1[istream.formatted.reqmts] --> | ||
{{dsc concept | cpp/concept/FormattedInputFunction | a stream input function that skips leading whitespace}} | {{dsc concept | cpp/concept/FormattedInputFunction | a stream input function that skips leading whitespace}} | ||
Line 81: | Line 81: | ||
{{dsc h1 | Concurrency}} | {{dsc h1 | Concurrency}} | ||
{{dsc concept | cpp/concept/BasicLockable | provides exclusive ownership semantics for execution agents (i.e. threads) | notes={{mark c++11}} }} | {{dsc concept | cpp/concept/BasicLockable | provides exclusive ownership semantics for execution agents (i.e. threads) | notes={{mark c++11}} }} | ||
− | {{dsc concept | cpp/concept/Lockable | | + | {{dsc concept | cpp/concept/Lockable | a {{concept|BasicLockable}} that supports attempted lock acquisition | notes={{mark c++11}} }} |
− | {{dsc concept | cpp/concept/TimedLockable | | + | {{dsc concept | cpp/concept/TimedLockable | a {{concept|Lockable}} that supports timed lock acquisition | notes={{mark c++11}} }} |
{{dsc concept | cpp/concept/Mutex | a {{concept|Lockable}} that protects against data races and sequentially consistent synchronization | notes={{mark c++11}} }} | {{dsc concept | cpp/concept/Mutex | a {{concept|Lockable}} that protects against data races and sequentially consistent synchronization | notes={{mark c++11}} }} | ||
{{dsc concept | cpp/concept/TimedMutex | a {{concept|TimedLockable}} that protects against data races and sequentially consistent synchronization | notes={{mark c++11}} }} | {{dsc concept | cpp/concept/TimedMutex | a {{concept|TimedLockable}} that protects against data races and sequentially consistent synchronization | notes={{mark c++11}} }} | ||
− | {{dsc concept | cpp/concept/SharedMutex | a {{concept|Mutex}} that supports shared ownership | + | {{dsc concept | cpp/concept/SharedMutex | a {{concept|Mutex}} that supports shared ownership semantics | notes={{mark c++17}} }} |
− | {{dsc concept | cpp/concept/SharedTimedMutex | a {{concept|TimedMutex}} that supports shared ownership | + | {{dsc concept | cpp/concept/SharedTimedMutex | a {{concept|TimedMutex}} that supports shared ownership semantics | notes={{mark c++14}} }} |
{{dsc h1 | Other}} | {{dsc h1 | Other}} | ||
Line 93: | Line 93: | ||
{{dsc concept | cpp/concept/TransformationTrait | modifies a property of a type | notes={{mark c++11}} }} | {{dsc concept | cpp/concept/TransformationTrait | modifies a property of a type | notes={{mark c++11}} }} | ||
{{dsc concept | cpp/concept/Clock | aggregates a duration, a time point, and a function to get the current time point | notes={{mark c++11}} }} | {{dsc concept | cpp/concept/Clock | aggregates a duration, a time point, and a function to get the current time point | notes={{mark c++11}} }} | ||
− | {{dsc concept | cpp/concept/TrivialClock | a {{concept|Clock}} that | + | {{dsc concept | cpp/concept/TrivialClock | a {{concept|Clock}} that does not throw exceptions | notes={{mark c++11}} }} |
{{dsc concept | cpp/concept/CharTraits | defines types and functions for a character type}} | {{dsc concept | cpp/concept/CharTraits | defines types and functions for a character type}} | ||
{{dsc concept | cpp/concept/pos_type | represents a position in a stream }} | {{dsc concept | cpp/concept/pos_type | represents a position in a stream }} |
Revision as of 01:04, 2 February 2016
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. It is expected that a future version of the C++ standard library will formalize these library concepts using the facilities of the above-mentioned technical specification. Until then, the burden is on the programmer to ensure that library templates are instantiated with template arguments that satisfy these concepts. Failure to do so may result in very complex compiler diagnostics.
Basic | ||
specifies that an object of the type can be default constructed (concept) | ||
(C++11) |
specifies that an object of the type can be constructed from rvalue (concept) | |
specifies that an object of the type can be constructed from lvalue (concept) | ||
(C++11) |
specifies that an object of the type can be assigned from rvalue (concept) | |
specifies that an object of the type can be assigned from lvalue (concept) | ||
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. | ||
(C++11) |
class with trivial copy, assignment and destructor (concept) | |
(C++11) |
class with trivial constructors, assignment and destructor (concept) | |
(C++11) |
non-virtual class containing only other StandardLayout members, all with the same access control (concept) | |
POD (Plain Old Data) structure, compatible with C struct (concept) | ||
Library-wide | ||
operator== is an equivalence relation (concept) | ||
operator< is a strict weak ordering relation (concept) | ||
(C++11) |
can be swapped with an unqualified non-member function call swap() (concept) | |
(C++11) |
an Template:concept that dereferences to a Template:concept type (concept) | |
(C++11) |
a pointer-like type supporting a null value (concept) | |
(C++11) |
a Template:concept that for inputs with different values has a low probability of giving the same output (concept) | |
a class type that contains allocation information (concept) | ||
an object that can be called with the function call syntax (concept) | ||
a type for which the invoke operation is defined (concept) | ||
a Template:concept that returns a value convertible to bool for one argument without modifying it (concept) | ||
a Template:concept that returns a value convertible to bool for two arguments without modifying them (concept) | ||
a Template:concept that establishes an ordering relation (concept) |
Container | |
data structure that allows element access using iterators (concept) | |
container using bidirectional iterators (concept) | |
(C++11) |
container using an allocator (concept) |
container with elements stored linearly (concept) | |
(C++17) |
container with elements stored at adjacent memory addresses (concept) |
container that stores elements by associating them to keys (concept) | |
container that stores elements stored in buckets by associating them to keys (concept) | |
Container element | |
(C++11) |
element can be default-constructed in uninitialized storage (concept) |
(C++11) |
element can be copy-constructed in uninitialized storage (concept) |
(C++11) |
element can be move-constructed in uninitialized storage (concept) |
(C++11) |
element can be constructed in uninitialized storage (concept) |
(C++11) |
element can be destroyed using an allocator (concept) |
Iterator | |
general concept to access data within some data structure (concept) | |
iterator that can be used to read data (concept) | |
iterator that can be used to write data (concept) | |
iterator that can be used to read data multiple times (concept) | |
iterator that can be both incremented and decremented (concept) | |
iterator that can be advanced in constant time (concept) | |
(C++17) |
iterator to contiguously-allocated elements (concept) |
Stream I/O functions | |
a stream input function that does not skip leading whitespace and counts the processed characters (concept) | |
a stream input function that skips leading whitespace (concept) | |
a basic stream output function (concept) | |
a stream output function that sets failbit on errors and returns a reference to the stream (concept) | |
Random Number Generation | |
(C++11) |
consumes a sequence of integers and produces a sequence of 32-bit unsigned values (concept) |
(C++11) |
returns uniformly distributed random unsigned integers (concept) |
(C++11) |
a deterministic Template:concept, defined by the seed (concept) |
(C++11) |
a Template:concept that transforms the output of another Template:concept (concept) |
(C++11) |
returns random numbers distributed according to a given mathematical probability density function (concept) |
Concurrency | |
(C++11) |
provides exclusive ownership semantics for execution agents (i.e. threads) (concept) |
(C++11) |
a Template:concept that supports attempted lock acquisition (concept) |
(C++11) |
a Template:concept that supports timed lock acquisition (concept) |
(C++11) |
a Template:concept that protects against data races and sequentially consistent synchronization (concept) |
(C++11) |
a Template:concept that protects against data races and sequentially consistent synchronization (concept) |
(C++17) |
a Template:concept that supports shared ownership semantics (concept) |
(C++14) |
a Template:concept that supports shared ownership semantics (concept) |
Other | |
(C++11) |
describes a property of a type (concept) |
(C++11) |
describes a relationship between two types (concept) |
(C++11) |
modifies a property of a type (concept) |
(C++11) |
aggregates a duration, a time point, and a function to get the current time point (concept) |
(C++11) |
a Template:concept that does not throw exceptions (concept) |
defines types and functions for a character type (concept) | |
represents a position in a stream (concept) | |
represents an offset in a stream (concept) | |
bitset, integer, or enumeration (concept) | |
a type for which initialization is effectively equal to assignment (concept) | |
(C++11) |
defines types and functions used by the regular expressions library (concept) |
(C++11) |
a type with constexpr constructor (concept) |
This section is incomplete Reason: Any other missing concept? |