@@ -957,7 +957,214 @@ TYPED_TEST(ReversibleContainerRequirements, REnd) {
957957 }
958958}
959959
960- // TODO: Test sequence container reqs.
960+ // [sequence.reqmts]
961+ template <typename Param> class Constructors : public BasicTest <Param> {};
962+ TYPED_TEST_SUITE (SequenceContainerRequirments, AllTypes);
963+
964+ // X u(n, t);
965+ // Preconditions: T is Cpp17CopyInsertable into X.
966+ // Effects: Constructs a sequence container with n copies of t.
967+ // Postconditions: distance(u.begin(), u.end()) == n is true.
968+
969+ // X u(i, j);
970+ // Preconditions: T is Cpp17EmplaceConstructible into X from *i. For vector, if
971+ // the iterator does not meet the Cpp17ForwardIterator requirements
972+ // ([forward.iterators]), T is also Cpp17MoveInsertable into X. Effects:
973+ // Constructs a sequence container equal to the range [i, j). Each iterator in
974+ // the range [i, j) is dereferenced exactly once. Postconditions:
975+ // distance(u.begin(), u.end()) == distance(i, j) is true.
976+
977+ // X(from_range, rg)
978+ // Preconditions: T is Cpp17EmplaceConstructible into X from
979+ // *ranges::begin(rg). For vector, if R models neither
980+ // ranges::sized_range nor ranges::forward_range, T is also
981+ // Cpp17MoveInsertable into X. Effects: Constructs a sequence container equal to
982+ // the range rg. Each iterator in the range rg is dereferenced exactly once.
983+ // Postconditions: distance(begin(), end()) == ranges::distance(rg) is
984+ // true.
985+
986+ // X(il)
987+ // Effects: Equivalent to X(il.begin(), il.end()).
988+
989+ // a = il
990+ // Result: X&.
991+ // Preconditions: T is Cpp17CopyInsertable into X and Cpp17CopyAssignable.
992+ // Effects: Assigns the range [il.begin(), il.end()) into a. All existing
993+ // elements of a are either assigned to or destroyed. Returns: *this.
994+
995+ // a.emplace(p, args)
996+ // Result: iterator.
997+ // Preconditions: T is Cpp17EmplaceConstructible into X from args. For vector,
998+ // inplace_vector, and deque, T is also Cpp17MoveInsertable into X and
999+ // Cpp17MoveAssignable. Effects: Inserts an object of type T constructed with
1000+ // std::forward<Args>(args)... before p. [Note 1: args can directly or
1001+ // indirectly refer to a value in a. — end note] Returns: An iterator that
1002+ // points to the new element.
1003+
1004+ // a.insert(p, t)
1005+ // Result: iterator.
1006+ // Preconditions: T is Cpp17CopyInsertable into X. For vector, inplace_vector,
1007+ // and deque, T is also Cpp17CopyAssignable. Effects: Inserts a copy of t before
1008+ // p. Returns: An iterator that points to the copy of t inserted into a.
1009+
1010+ // a.insert(p, rv)
1011+ // Result: iterator.
1012+ // Preconditions: T is Cpp17MoveInsertable into X. For vector, inplace_vector,
1013+ // and deque, T is also Cpp17MoveAssignable. Effects: Inserts a copy of rv
1014+ // before p. Returns: An iterator that points to the copy of rv inserted into a.
1015+
1016+ // a.insert(p, n, t)
1017+ // Result: iterator.
1018+ // Preconditions: T is Cpp17CopyInsertable into X and Cpp17CopyAssignable.
1019+ // Effects: Inserts n copies of t before p.
1020+ // Returns: An iterator that points to the copy of the first element inserted
1021+ // into a, or p if n == 0.
1022+
1023+ // a.insert(p, i, j)
1024+ // Result: iterator.
1025+ // Preconditions: T is Cpp17EmplaceConstructible into X from *i. For vector,
1026+ // inplace_vector, and deque, T is also Cpp17MoveInsertable into X, and T meets
1027+ // the Cpp17MoveConstructible, Cpp17MoveAssignable, and Cpp17Swappable
1028+ // ([swappable.requirements]) requirements. Neither i nor j are iterators into
1029+ // a. Effects: Inserts copies of elements in [i, j) before p. Each iterator in
1030+ // the range [i, j) shall be dereferenced exactly once. Returns: An iterator
1031+ // that points to the copy of the first element inserted into a, or p if i == j.
1032+
1033+ // a.insert_range(p, rg)
1034+ // Result: iterator.
1035+ // Preconditions: T is Cpp17EmplaceConstructible into X from
1036+ // *ranges::begin(rg). For vector, inplace_vector, and deque, T is also
1037+ // Cpp17MoveInsertable into X, and T meets the Cpp17MoveConstructible,
1038+ // Cpp17MoveAssignable, and Cpp17Swappable ([swappable.requirements])
1039+ // requirements. rg and a do not overlap. Effects: Inserts copies of elements in
1040+ // rg before p. Each iterator in the range rg is dereferenced exactly once.
1041+ // Returns: An iterator that points to the copy of the first element inserted
1042+ // into a, or p if rg is empty.
1043+
1044+ // a.insert(p, il)
1045+ // Effects: Equivalent to a.insert(p, il.begin(), il.end()).
1046+ // a.erase(q)
1047+ // Result: iterator.
1048+ // Preconditions: For vector, inplace_vector, and deque, T is
1049+ // Cpp17MoveAssignable. Effects: Erases the element pointed to by q. Returns: An
1050+ // iterator that points to the element immediately following q prior to the
1051+ // element being erased. If no such element exists, a.end() is returned.
1052+
1053+ // a.erase(q1, q2)
1054+ // Result: iterator.
1055+ // Preconditions: For vector, inplace_vector, and deque, T is
1056+ // Cpp17MoveAssignable. Effects: Erases the elements in the range [q1, q2).
1057+ // Returns: An iterator that points to the element pointed to by q2 prior to any
1058+ // elements being erased. If no such element exists, a.end() is returned.
1059+
1060+ // a.clear()
1061+ // Result: void
1062+ // Effects: Destroys all elements in a. Invalidates all references, pointers,
1063+ // and iterators referring to the elements of a and may invalidate the
1064+ // past-the-end iterator. Postconditions: a.empty() is true. Complexity: Linear.
1065+
1066+ // a.assign(i, j)
1067+ // Result: void
1068+ // Preconditions: T is Cpp17EmplaceConstructible into X from *i and assignable
1069+ // from *i. For vector, if the iterator does not meet the forward iterator
1070+ // requirements ([forward.iterators]), T is also Cpp17MoveInsertable into X.
1071+ // Neither i nor j are iterators into a. Effects: Replaces elements in a with a
1072+ // copy of [i, j). Invalidates all references, pointers and iterators referring
1073+ // to the elements of a. For vector and deque, also invalidates the past-the-end
1074+ // iterator. Each iterator in the range [i, j) is dereferenced exactly once.
1075+
1076+ // a.assign_range(rg)
1077+ // Result: void
1078+ // Mandates: assignable_from<T&, ranges::range_reference_t<R>> is modeled.
1079+ // Preconditions: T is Cpp17EmplaceConstructible into X from
1080+ // *ranges::begin(rg). For vector, if R models neither
1081+ // ranges::sized_range nor ranges::forward_range, T is also
1082+ // Cpp17MoveInsertable into X. rg and a do not overlap. Effects: Replaces
1083+ // elements in a with a copy of each element in rg. Invalidates all references,
1084+ // pointers, and iterators referring to the elements of a. For vector and deque,
1085+ // also invalidates the past-the-end iterator. Each iterator in the range rg is
1086+ // dereferenced exactly once.
1087+
1088+ // a.assign(il)
1089+ // Effects: Equivalent to a.assign(il.begin(), il.end()).
1090+
1091+ // a.assign(n, t)
1092+ // Result: void
1093+ // Preconditions: T is Cpp17CopyInsertable into X and Cpp17CopyAssignable. t is
1094+ // not a reference into a. Effects: Replaces elements in a with n copies of t.
1095+ // Invalidates all references, pointers and iterators referring to the elements
1096+ // of a. For vector and deque, also invalidates the past-the-end iterator. For
1097+ // every sequence container defined in this Clause and in [strings]:
1098+ //
1099+ // If the constructor
1100+ // template<class InputIterator>
1101+ // X(InputIterator first, InputIterator last,
1102+ // const allocator_type& alloc = allocator_type());
1103+ //
1104+ // is called with a type InputIterator that does not qualify as an input
1105+ // iterator, then the constructor shall not participate in overload resolution.
1106+ //
1107+ // If the member functions of the forms:
1108+ // template<class InputIterator>
1109+ // return-type F(const_iterator p,
1110+ // InputIterator first, InputIterator last); // such as
1111+ // insert
1112+ //
1113+ // template<class InputIterator>
1114+ // return-type F(InputIterator first, InputIterator last); // such as
1115+ // append, assign
1116+ //
1117+ // template<class InputIterator>
1118+ // return-type F(const_iterator i1, const_iterator i2,
1119+ // InputIterator first, InputIterator last); // such as
1120+ // replace
1121+ //
1122+ // are called with a type InputIterator that does not qualify as an input
1123+ // iterator, then these functions shall not participate in overload resolution.
1124+ // A deduction guide for a sequence container shall not participate in overload
1125+ // resolution if it has an InputIterator template parameter and a type that does
1126+ // not qualify as an input iterator is deduced for that parameter, or if it has
1127+ // an Allocator template parameter and a type that does not qualify as an
1128+ // allocator is deduced for that parameter. The following operations are
1129+ // provided for some types of sequence containers but not others. Operations
1130+ // other than prepend_range and append_range are implemented so as to take
1131+ // amortized constant time. Result: reference; const_reference for constant a.
1132+ // Returns: *a.begin()
1133+ // a.back()
1134+ // Result: reference; const_reference for constant a.
1135+ // Effects: Equivalent to:
1136+ // auto tmp = a.end();
1137+ // --tmp;
1138+ // return *tmp;
1139+ // Remarks: Required for basic_string, array, deque, inplace_vector, list, and
1140+ // vector.
1141+
1142+ // a.emplace_back(args)
1143+ // Returns: a.back().
1144+
1145+ // a.push_back(t)
1146+ // Result: void
1147+ // Preconditions: T is Cpp17CopyInsertable into X.
1148+ // Effects: Appends a copy of t.
1149+
1150+ // a.push_back(rv)
1151+ // Result: void
1152+ // Preconditions: T is Cpp17MoveInsertable into X.
1153+ // Effects: Appends a copy of rv.
1154+
1155+ // a.pop_back()
1156+ // Result: void
1157+ // Preconditions: a.empty() is false.
1158+ // Effects: Destroys the last element.
1159+
1160+ // a[n]
1161+ // Result: reference; const_reference for constant
1162+ // Effects: Equivalent to: return *(a.begin() + n);
1163+
1164+ // a.at(n)
1165+ // Result: reference; const_reference for constant a
1166+ // Returns: *(a.begin() + n)
1167+ // Throws: out_of_range if n >= a.size().
9611168
9621169// 3 For any N, inplace_vector<T, N>::iterator and inplace_vector<T,
9631170// N>::const_iterator meet the constexpr iterator requirements.
0 commit comments