Namespaces
Variants

C++ named requirements: SequenceContainer

From cppreference.com
 
 
C++ named requirements
 

A SequenceContainer is a Container that stores objects of the same type in a linear arrangement.

Requirements

Given the following types and values:

Type Definition
C a sequence container class
T the element type of C
A the allocator type of C:
  • C::allocator_type if it exists,
  • otherwise std::allocator<T>
R (since C++23) a type that models container-compatible-range <T>
Args (since C++11) a template parameter pack
Iter C::iterator
Ref C::reference
CRef C::const_reference
Value Definition
v a value of type C
cv a value of type const C
i, j LegacyInputIterators such that [i, j) is a valid range and that the iterators refer to elements implicitly convertible to C::value_type
rg (since C++23) a value of type R
il (since C++11) a value of type std::initializer_list<C::value_type>
n a value of type C::size_type
p a valid const iterator into v
q a valid dereferenceable const iterator into v
q1, q2 const iterators into v such that [q1, q2) is a valid range
t a value(until C++11)an lvalue or const rvalue(since C++11) of type C::value_type
rv (since C++11) a non-const rvalue of type C::value_type
args (since C++11) a function parameter pack with the pattern Arg&&

C satisfies the requirements of SequenceContainer if all following conditions are satisfied:

  • C satisfies the requirements of Container.
  • The following statements and expressions are well-formed and have the specified semantics:
Basic operations
(required for all sequence containers in the standard library except std::array(since C++11))
Statement     Semantics[1]
C c(n, t); Effect Constructs the sequence container holding n copies of t.
Precondition

T is CopyInsertable into C.

(since C++11)
Postcondition  std::distance(c.begin(), c.end()) is n.
C c(i, j); Effect Constructs the sequence container equal, element-wise, to the range [i, j).
  • Each iterator in the range [i, j) is dereferenced exactly once.
Precondition

T is EmplaceConstructible into C from *i.

(since C++11)
Postcondition std::