Skip to main content

Named Requirements

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

pubDefaultConstructiblespecifies that an object of the type can be default constructed
pubMoveConstructible(C++11)specifies that an object of the type can be constructed from rvalue
pubCopyConstructiblespecifies that an object of the type can be constructed from lvalue
pubMoveAssignable(C++11)specifies that an object of the type can be assigned from rvalue
pubCopyAssignablespecifies that an object of the type can be assigned from lvalue
pubDestructiblespecifies that an object of the type can be destroyed

Type properties


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.


pubScalarTypeobject types that are not array types or class types
pubPODType (deprecated in C++20)POD (Plain Old Data) types, compatible with C struct
pubTriviallyCopyable(C++11)objects of these types can maintain their values after copying their underlying bytes
pubTrivialType(C++11)objects of these types can be trivially constructed and copied
pubStandardLayoutType(C++11)these types are useful for communicating with code written in other programming languages
pubImplicitLifetimeTypeobjects of these types can be implicitly created, and their lifetimes can be implicitly started

Library-wide

pubEqualityComparableoperator== is an equivalence relation
pubLessThanComparableoperator< is a strict weak ordering relation
pubSwappablecan be swapped with an unqualified non-member function call swap()
pubValueSwappable(C++11)a LegacyIterator that dereferences to a Swappable type
pubNullablePointer(C++11)a pointer-like type supporting a null value
pubHash(C++11)a FunctionObject that for inputs with different values has a low probability of giving the same output
pubAllocatora class type that contains allocation information
pubFunctionObjectan object that can be called with the function call syntax
pubCallablea type for which the invoke operation is defined
pubPredicatea FunctionObject that returns a value convertible to bool for one argument without modifying it
pubBinaryPredicatea FunctionObject that returns a value convertible to bool for two arguments without modifying them
pubComparea BinaryPredicate that establishes an ordering relation

Container

pubContainerdata structure that allows element access using iterators
pubReversibleContainercontainer using bidirectional iterators
pubAllocatorAwareContainer(C++11)container using an allocator
pubSequenceContainercontainer with elements stored linearly
pubContiguousContainer(C++17)container with elements stored at adjacent memory addresses
pubAssociativeContainercontainer that stores elements by associating them to keys
pubUnorderedAssociativeContainer(C++11)container that stores elements stored in buckets by associating them to keys

Container element

pubDefaultInsertable(C++11)element can be default-constructed in uninitialized storage
pubCopyInsertable(C++11)element can be copy-constructed in uninitialized storage
pubMoveInsertable(C++11)element can be move-constructed in uninitialized storage
pubEmplaceConstructible(C++11)element can be constructed in uninitialized storage
pubErasable(C++11)element can be destroyed using an allocator

Iterator

pubLegacyIteratorgeneral concept to access data within some data structure
pubLegacyInputIteratoriterator that can be used to read data
pubLegacyOutputIteratoriterator that can be used to write data
pubLegacyForwardIteratoriterator that can be used to read data multiple times
pubLegacyBidirectionalIteratoriterator that can be both incremented and decremented
pubLegacyRandomAccessIteratoriterator that can be advanced in constant time
pubLegacyContiguousIterator(C++17)iterator to contiguously-allocated elements
pubConstexprIterator(C++20)iterator that can be used during constant expression evaluation

Stream I/O functions

pubUnformattedInputFunctiona stream input function that does not skip leading whitespace and counts the processed characters
pubFormattedInputFunctiona stream input function that skips leading whitespace
pubUnformattedOutputFunctiona basic stream output function
pubFormattedOutputFunctiona stream output function that sets failbit on errors and returns a reference to the stream

Formatters

pubBasicFormatter(C++20)abstracts formatting operations for a given formatting argument type and character type
pubFormatter(C++20)defines functions used by the formatting library

Random Number Generation

pubSeedSequence(C++11)consumes a sequence of integers and produces a sequence of 32-bit unsigned values
pubUniformRandomBitGenerator(C++11)returns uniformly distributed random unsigned integers
pubRandomNumberEngine(C++11)a deterministic UniformRandomBitGenerator, defined by the seed
pubRandomNumberEngineAdaptor(C++11)a RandomNumberEngine that transforms the output of another RandomNumberEngine
pubRandomNumberDistribution(C++11)returns random numbers distributed according to a given mathematical probability density function

Concurrency

pubBasicLockable(C++11)provides exclusive ownership semantics for execution agents (i.e. threads)
pubLockable(C++11)a BasicLockable that supports attempted lock acquisition
pubTimedLockable(C++11)a Lockable that supports timed lock acquisition
pubSharedLockable(C++14)provides shared ownership semantics for execution agents (i.e. threads)
pubSharedTimedLockable(C++14)a SharedLockable that supports timed lock acquisition
pubMutex(C++11)a Lockable that protects against data races and sequentially consistent synchronization
pubTimedMutex(C++11)a TimedLockable that protects against data races and sequentially consistent synchronization
pub(C++17)a Mutex that supports shared ownership semantics
pubSharedTimedMutex(C++14)a TimedMutex that supports shared ownership semantics

Ranges

pubRangeAdaptorObject(C++20)a FunctionObject that creates a range adaptor from a viewable_range and additional arguments
pubRangeAdaptorClosureObject(C++20)a FunctionObject that supports the pipe operator

Other

pubUnaryTypeTrait(C++11)describes a property of a type
pubBinaryTypeTrait(C++11)describes a relationship between two types
pubTransformationTrait(C++11)modifies a property of a type
pubClock(C++11)aggregates a duration, a time point, and a function to get the current time point
pubTrivialClock(C++11)a Clock that does not throw exceptions
pubCharTraitsdefines types and functions for a character type
pubBitmaskTypebitset, integer, or enumeration
pubNumericTypea type for which initialization is effectively equal to assignment
pubRegexTraits(C++11)defines types and functions used by the regular expressions library
pubLiteralType(C++11)a type with constexpr constructor

Named Requirements

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

pubDefaultConstructiblespecifies that an object of the type can be default constructed
pubMoveConstructible(C++11)specifies that an object of the type can be constructed from rvalue
pubCopyConstructiblespecifies that an object of the type can be constructed from lvalue
pubMoveAssignable(C++11)specifies that an object of the type can be assigned from rvalue
pubCopyAssignablespecifies that an object of the type can be assigned from lvalue
pubDestructiblespecifies that an object of the type can be destroyed

Type properties


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.


pubScalarTypeobject types that are not array types or class types
pubPODType (deprecated in C++20)POD (Plain Old Data) types, compatible with C struct
pubTriviallyCopyable(C++11)objects of these types can maintain their values after copying their underlying bytes
pubTrivialType(C++11)objects of these types can be trivially constructed and copied
pubStandardLayoutType(C++11)these types are useful for communicating with code written in other programming languages
pubImplicitLifetimeTypeobjects of these types can be implicitly created, and their lifetimes can be implicitly started

Library-wide

pubEqualityComparableoperator== is an equivalence relation
pubLessThanComparableoperator< is a strict weak ordering relation
pubSwappablecan be swapped with an unqualified non-member function call swap()
pubValueSwappable(C++11)a LegacyIterator that dereferences to a Swappable type
pubNullablePointer(C++11)a pointer-like type supporting a null value
pubHash(C++11)a FunctionObject that for inputs with different values has a low probability of giving the same output
pubAllocatora class type that contains allocation information
pubFunctionObjectan object that can be called with the function call syntax
pubCallablea type for which the invoke operation is defined
pubPredicatea FunctionObject that returns a value convertible to bool for one argument without modifying it
pubBinaryPredicatea FunctionObject that returns a value convertible to bool for two arguments without modifying them
pubComparea BinaryPredicate that establishes an ordering relation

Container

pubContainerdata structure that allows element access using iterators
pubReversibleContainercontainer using bidirectional iterators
pubAllocatorAwareContainer(C++11)container using an allocator
pubSequenceContainercontainer with elements stored linearly
pubContiguousContainer(C++17)container with elements stored at adjacent memory addresses
pubAssociativeContainercontainer that stores elements by associating them to keys
pubUnorderedAssociativeContainer(C++11)container that stores elements stored in buckets by associating them to keys

Container element

pubDefaultInsertable(C++11)element can be default-constructed in uninitialized storage
pubCopyInsertable(C++11)element can be copy-constructed in uninitialized storage
pubMoveInsertable(C++11)element can be move-constructed in uninitialized storage
pubEmplaceConstructible(C++11)element can be constructed in uninitialized storage
pubErasable(C++11)element can be destroyed using an allocator

Iterator

pubLegacyIteratorgeneral concept to access data within some data structure
pubLegacyInputIteratoriterator that can be used to read data
pubLegacyOutputIteratoriterator that can be used to write data
pubLegacyForwardIteratoriterator that can be used to read data multiple times
pubLegacyBidirectionalIteratoriterator that can be both incremented and decremented
pubLegacyRandomAccessIteratoriterator that can be advanced in constant time
pubLegacyContiguousIterator(C++17)iterator to contiguously-allocated elements
pubConstexprIterator(C++20)iterator that can be used during constant expression evaluation

Stream I/O functions

pubUnformattedInputFunctiona stream input function that does not skip leading whitespace and counts the processed characters
pubFormattedInputFunctiona stream input function that skips leading whitespace
pubUnformattedOutputFunctiona basic stream output function
pubFormattedOutputFunctiona stream output function that sets failbit on errors and returns a reference to the stream

Formatters

pubBasicFormatter(C++20)abstracts formatting operations for a given formatting argument type and character type
pubFormatter(C++20)defines functions used by the formatting library

Random Number Generation

pubSeedSequence(C++11)consumes a sequence of integers and produces a sequence of 32-bit unsigned values
pubUniformRandomBitGenerator(C++11)returns uniformly distributed random unsigned integers
pubRandomNumberEngine(C++11)a deterministic UniformRandomBitGenerator, defined by the seed
pubRandomNumberEngineAdaptor(C++11)a RandomNumberEngine that transforms the output of another RandomNumberEngine
pubRandomNumberDistribution(C++11)returns random numbers distributed according to a given mathematical probability density function

Concurrency

pubBasicLockable(C++11)provides exclusive ownership semantics for execution agents (i.e. threads)
pubLockable(C++11)a BasicLockable that supports attempted lock acquisition
pubTimedLockable(C++11)a Lockable that supports timed lock acquisition
pubSharedLockable(C++14)provides shared ownership semantics for execution agents (i.e. threads)
pubSharedTimedLockable(C++14)a SharedLockable that supports timed lock acquisition
pubMutex(C++11)a Lockable that protects against data races and sequentially consistent synchronization
pubTimedMutex(C++11)a TimedLockable that protects against data races and sequentially consistent synchronization
pub(C++17)a Mutex that supports shared ownership semantics
pubSharedTimedMutex(C++14)a TimedMutex that supports shared ownership semantics

Ranges

pubRangeAdaptorObject(C++20)a FunctionObject that creates a range adaptor from a viewable_range and additional arguments
pubRangeAdaptorClosureObject(C++20)a FunctionObject that supports the pipe operator

Other

pubUnaryTypeTrait(C++11)describes a property of a type
pubBinaryTypeTrait(C++11)describes a relationship between two types
pubTransformationTrait(C++11)modifies a property of a type
pubClock(C++11)aggregates a duration, a time point, and a function to get the current time point
pubTrivialClock(C++11)a Clock that does not throw exceptions
pubCharTraitsdefines types and functions for a character type
pubBitmaskTypebitset, integer, or enumeration
pubNumericTypea type for which initialization is effectively equal to assignment
pubRegexTraits(C++11)defines types and functions used by the regular expressions library
pubLiteralType(C++11)a type with constexpr constructor