Difference between revisions of "cpp/named req"
m (Text replace - "cpp/concept" to "cpp/named req") |
m (Text replace - "dsc concept" to "dsc named req") |
||
Line 10: | Line 10: | ||
{{dsc begin}} | {{dsc begin}} | ||
{{dsc h1 | Basic}} | {{dsc h1 | Basic}} | ||
− | {{dsc | + | {{dsc named req | cpp/named req/DefaultConstructible | specifies that an object of the type can be default constructed}} |
− | {{dsc | + | {{dsc named req | cpp/named req/MoveConstructible | specifies that an object of the type can be constructed from rvalue | notes={{mark c++11}}}} |
− | {{dsc | + | {{dsc named req | cpp/named req/CopyConstructible | specifies that an object of the type can be constructed from lvalue}} |
− | {{dsc | + | {{dsc named req | cpp/named req/MoveAssignable | specifies that an object of the type can be assigned from rvalue| notes={{mark c++11}}}} |
− | {{dsc | + | {{dsc named req | cpp/named req/CopyAssignable | specifies that an object of the type can be assigned from lvalue}} |
− | {{dsc | + | {{dsc named req | cpp/named req/Destructible | specifies that an object of the type can be destroyed}} |
{{dsc h1 | Layout}} | {{dsc h1 | Layout}} | ||
{{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 | 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 | + | {{dsc named req | cpp/named req/TriviallyCopyable | class with trivial copy, assignment and destructor | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/TrivialType | class with trivial constructors, assignment and destructor | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/StandardLayoutType | non-virtual class containing only other StandardLayout members, all with the same access control | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/PODType | POD (Plain Old Data) structure, compatible with C {{c|struct}} }} |
{{dsc h1 | Library-wide}} | {{dsc h1 | Library-wide}} | ||
− | {{dsc | + | {{dsc named req | cpp/named req/EqualityComparable | {{tt|operator{{==}}}} is an equivalence relation}} |
− | {{dsc | + | {{dsc named req | cpp/named req/LessThanComparable | {{tt|operator<}} is a strict weak ordering relation}} |
− | {{dsc | + | {{dsc named req | cpp/named req/Swappable| can be swapped with an unqualified non-member function call {{c|swap()}} | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/ValueSwappable| an {{concept|Iterator}} that dereferences to a {{concept|Swappable}} type | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/NullablePointer| a pointer-like type supporting a null value | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/Hash | a {{concept|FunctionObject}} that for inputs with different values has a low probability of giving the same output | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/Allocator| a class type that contains allocation information}} |
− | {{dsc | + | {{dsc named req | cpp/named req/FunctionObject | an object that can be called with the function call syntax}} |
− | {{dsc | + | {{dsc named req | cpp/named req/Callable | a type for which the invoke operation is defined}} |
− | {{dsc | + | {{dsc named req | cpp/named req/Predicate | a {{concept|FunctionObject}} that returns a value convertible to {{c|bool}} for one argument without modifying it}} |
− | {{dsc | + | {{dsc named req | cpp/named req/BinaryPredicate | a {{concept|FunctionObject}} that returns a value convertible to {{c|bool}} for two arguments without modifying them}} |
− | {{dsc | + | {{dsc named req | cpp/named req/Compare | a {{concept|BinaryPredicate}} that establishes an ordering relation}} |
{{dsc end}} | {{dsc end}} | ||
{{dsc begin}} | {{dsc begin}} | ||
{{dsc h1 | Container}} | {{dsc h1 | Container}} | ||
− | {{dsc | + | {{dsc named req | cpp/named req/Container | data structure that allows element access using iterators }} |
− | {{dsc | + | {{dsc named req | cpp/named req/ReversibleContainer | container using bidirectional iterators }} |
− | {{dsc | + | {{dsc named req | cpp/named req/AllocatorAwareContainer | container using an allocator | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/SequenceContainer | container with elements stored linearly }} |
− | {{dsc | + | {{dsc named req | cpp/named req/ContiguousContainer | container with elements stored at adjacent memory addresses | notes={{mark c++17}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/AssociativeContainer | container that stores elements by associating them to keys }} |
− | {{dsc | + | {{dsc named req | cpp/named req/UnorderedAssociativeContainer | container that stores elements stored in buckets by associating them to keys | notes={{mark c++11}} }} |
{{dsc h2 | Container element}} | {{dsc h2 | Container element}} | ||
− | {{dsc | + | {{dsc named req | cpp/named req/DefaultInsertable| element can be default-constructed in uninitialized storage | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/CopyInsertable| element can be copy-constructed in uninitialized storage | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/MoveInsertable| element can be move-constructed in uninitialized storage | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/EmplaceConstructible| element can be constructed in uninitialized storage | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/Erasable| element can be destroyed using an allocator | notes={{mark c++11}} }} |
{{dsc h1 | Iterator}} | {{dsc h1 | Iterator}} | ||
− | {{dsc | + | {{dsc named req | cpp/named req/Iterator | general concept to access data within some data structure }} |
− | {{dsc | + | {{dsc named req | cpp/named req/InputIterator | iterator that can be used to read data }} |
− | {{dsc | + | {{dsc named req | cpp/named req/OutputIterator | iterator that can be used to write data }} |
− | {{dsc | + | {{dsc named req | cpp/named req/ForwardIterator | iterator that can be used to read data multiple times}} |
− | {{dsc | + | {{dsc named req | cpp/named req/BidirectionalIterator | iterator that can be both incremented and decremented }} |
− | {{dsc | + | {{dsc named req | cpp/named req/RandomAccessIterator | iterator that can be advanced in constant time }} |
− | {{dsc | + | {{dsc named req | cpp/named req/ContiguousIterator | iterator to contiguously-allocated elements |notes={{mark c++17}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/ConstexprIterator | iterator that can be used during constant expression evaluation |notes={{mark c++20}} }} |
{{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 | + | {{dsc named req | cpp/named req/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 | + | {{dsc named req | cpp/named req/FormattedInputFunction | a stream input function that skips leading whitespace}} |
<!-- 27.7.3.7[ostream.unformatted]/1 --> | <!-- 27.7.3.7[ostream.unformatted]/1 --> | ||
− | {{dsc | + | {{dsc named req | cpp/named req/UnformattedOutputFunction | a basic stream output function }} |
<!-- 27.7.3.6.1[ostream.formatted.reqmts] --> | <!-- 27.7.3.6.1[ostream.formatted.reqmts] --> | ||
− | {{dsc | + | {{dsc named req | cpp/named req/FormattedOutputFunction | a stream output function that sets failbit on errors and returns a reference to the stream}} |
{{dsc h1 | Random Number Generation}} | {{dsc h1 | Random Number Generation}} | ||
− | {{dsc | + | {{dsc named req | cpp/named req/SeedSequence | consumes a sequence of integers and produces a sequence of 32-bit unsigned values | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/UniformRandomBitGenerator | returns uniformly distributed random unsigned integers | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/RandomNumberEngine | a deterministic {{concept|UniformRandomBitGenerator}}, defined by the seed | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/RandomNumberEngineAdaptor | a {{concept|RandomNumberEngine}} that transforms the output of another {{concept|RandomNumberEngine}} | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/RandomNumberDistribution | returns random numbers distributed according to a given mathematical probability density function | notes={{mark c++11}} }} |
{{dsc h1 | Concurrency}} | {{dsc h1 | Concurrency}} | ||
− | {{dsc | + | {{dsc named req | cpp/named req/BasicLockable | provides exclusive ownership semantics for execution agents (i.e. threads) | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/Lockable | a {{concept|BasicLockable}} that supports attempted lock acquisition | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/TimedLockable | a {{concept|Lockable}} that supports timed lock acquisition | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/Mutex | a {{concept|Lockable}} that protects against data races and sequentially consistent synchronization | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/TimedMutex | a {{concept|TimedLockable}} that protects against data races and sequentially consistent synchronization | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/SharedMutex | a {{concept|Mutex}} that supports shared ownership semantics | notes={{mark c++17}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/SharedTimedMutex | a {{concept|TimedMutex}} that supports shared ownership semantics | notes={{mark c++14}} }} |
{{dsc h1 | Other}} | {{dsc h1 | Other}} | ||
− | {{dsc | + | {{dsc named req | cpp/named req/UnaryTypeTrait | describes a property of a type | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/BinaryTypeTrait | describes a relationship between two types | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/TransformationTrait | modifies a property of a type | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/Clock | aggregates a duration, a time point, and a function to get the current time point | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/TrivialClock | a {{concept|Clock}} that does not throw exceptions | notes={{mark c++11}} }} |
− | {{dsc | + | {{dsc named req | cpp/named req/CharTraits | defines types and functions for a character type}} |
− | {{dsc | + | {{dsc named req | cpp/named req/BitmaskType | bitset, integer, or enumeration}} <!-- $17.5.2.1.3[bitmask types] --> |
− | {{dsc | + | {{dsc named req | cpp/named req/NumericType | a type for which initialization is effectively equal to assignment }} <!-- C++98/03 §26.1[lib.numeric.requirements], C++11/14 §26.2[numeric.requirements] --> |
− | {{dsc | + | {{dsc named req | cpp/named req/RegexTraits | defines types and functions used by the [[cpp/regex|regular expressions library]] | notes={{mark c++11}}}} <!-- C++11/14 §28.3[re.req] --> |
− | {{dsc | + | {{dsc named req | cpp/named req/LiteralType | a type with constexpr constructor | notes={{mark c++11}} }} |
{{dsc end}} | {{dsc end}} |
Revision as of 14:03, 15 June 2018
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 | ||
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, 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 (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 Template:concept that dereferences to a Template:concept type (named requirement) | |
(C++11) |
a pointer-like type supporting a null value (named requirement) | |
(C++11) |
a Template:concept 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 Template:concept that returns a value convertible to bool for one argument without modifying it (named requirement) | ||
a Template:concept that returns a value convertible to bool for two arguments without modifying them (named requirement) | ||
a Template:concept 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 Template:concept, defined by the seed (named requirement) |
(C++11) |
a Template:concept that transforms the output of another Template:concept (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 Template:concept that supports attempted lock acquisition (named requirement) |
(C++11) |
a Template:concept that supports timed lock acquisition (named requirement) |
(C++11) |
a Template:concept that protects against data races and sequentially consistent synchronization (named requirement) |
(C++11) |
a Template:concept that protects against data races and sequentially consistent synchronization (named requirement) |
(C++17) |
a Template:concept that supports shared ownership semantics (named requirement) |
(C++14) |
a Template:concept 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 Template:concept 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 concept? |