@@ -620,55 +620,9 @@ TYPED_TEST_SUITE(SequenceContainerRequirements, IVAllTypes);
620620
621621// See: Constructors/CopyRanges
622622
623+ // These functions are marked as freestand delete.
623624// X(il)
624- // Effects: Equivalent to X(il.begin(), il.end()).
625-
626- #if !BEMAN_INPLACE_VECTOR_FREESTANDING_DELETED()
627- TYPED_TEST (SequenceContainerRequirements, ConstructorInitializerList) {
628- using IV = TestFixture::IV;
629- using T = TestFixture::T;
630-
631- if (IV::capacity () == 0 ) {
632- SAFE_EXPECT_THROW (IV ({T{20 }}), std::bad_alloc);
633- return ;
634- }
635-
636- IV device ({T{20 }});
637-
638- IV correct;
639- correct.emplace_back (20 );
640- EXPECT_EQ (device, correct);
641-
642- if (IV::capacity () == 1 )
643- return ;
644-
645- device = IV ({T{20 }, T{21 }});
646- correct.emplace_back (21 );
647-
648- EXPECT_EQ (device, correct);
649- }
650-
651625// a = il
652- // Result: X&.
653- // Preconditions: T is Cpp17CopyInsertable into X and Cpp17CopyAssignable.
654- // Effects: Assigns the range [il.begin(), il.end()) into a. All existing
655- // elements of a are either assigned to or destroyed. Returns: *this.
656-
657- TYPED_TEST (SequenceContainerRequirements, AssignInitializerList) {
658- using IV = TestFixture::IV;
659- using T = TestFixture::T;
660-
661- if (IV::capacity () == 0 ) {
662- IV device;
663- SAFE_EXPECT_THROW (device = {T{52 }}, std::bad_alloc);
664- return ;
665- }
666-
667- IV device;
668- device = {T{20 }};
669- EXPECT_EQ (device, IV{T{20 }});
670- }
671- #endif
672626
673627// a.emplace(p, args)
674628// Result: iterator.
@@ -766,165 +720,11 @@ TYPED_TEST(SequenceContainerRequirements, Clear) {
766720 EXPECT_TRUE (device.empty ());
767721}
768722
769- # if !BEMAN_INPLACE_VECTOR_FREESTANDING_DELETED()
723+ // These functions are marked as freestand delete.
770724// a.assign(i, j)
771- // Result: void
772- // Preconditions: T is Cpp17EmplaceConstructible into X from *i and assignable
773- // from *i. For vector, if the iterator does not meet the forward iterator
774- // requirements ([forward.iterators]), T is also Cpp17MoveInsertable into X.
775- // Neither i nor j are iterators into a.
776- // Effects: Replaces elements in a with a copy of [i, j). Invalidates all
777- // references, pointers and iterators referring to the elements of a. For vector
778- // and deque, also invalidates the past-the-end iterator. Each iterator in the
779- // range [i, j) is dereferenced exactly once.
780-
781- TYPED_TEST (SequenceContainerRequirements, AssignIterRange) {
782- using IV = TestFixture::IV;
783- using T = TestFixture::T;
784- using InputIterator = TestFixture::InputIterator;
785-
786- {
787- auto device = this ->unique ();
788-
789- const auto correct = this ->unique ();
790-
791- device.assign (correct.begin (), correct.end ());
792- EXPECT_EQ (device, correct);
793-
794- std::array<T, IV::capacity () + 1 > ref{};
795- SAFE_EXPECT_THROW (device.assign (ref.begin (), ref.end ()), std::bad_alloc);
796- }
797-
798- {
799- IV device;
800- device.assign (InputIterator{0 }, InputIterator{IV::max_size ()});
801- EXPECT_EQ (device.size (), IV::max_size ());
802- // Each iterator in the range [i, j) is dereferenced exactly once.
803- if (!device.empty ()) {
804- EXPECT_EQ (device.back (), T{static_cast <int >(IV::max_size () - 1 )});
805- }
806-
807- // [containers.sequences.inplace.vector.overview]
808- // 5. Any member function of inplace_vector<T, N> that would cause the size
809- // to exceed N throws an exception of type bad_alloc.
810- SAFE_EXPECT_THROW (
811- device.assign (InputIterator{0 }, InputIterator{IV::max_size () + 1 }),
812- std::bad_alloc);
813- }
814- }
815-
816725// a.assign_range(rg)
817- // Result: void
818- // Mandates: assignable_from<T&, ranges::range_reference_t<R>> is modeled.
819- // Preconditions: T is Cpp17EmplaceConstructible into X from
820- // *ranges::begin(rg). For vector, if R models neither
821- // ranges::sized_range nor ranges::forward_range, T is also
822- // Cpp17MoveInsertable into X. rg and a do not overlap. Effects: Replaces
823- // elements in a with a copy of each element in rg. Invalidates all references,
824- // pointers, and iterators referring to the elements of a. For vector and deque,
825- // also invalidates the past-the-end iterator. Each iterator in the range rg is
826- // dereferenced exactly once.
827-
828- TYPED_TEST (SequenceContainerRequirements, AssignRange) {
829- using IV = TestFixture::IV;
830- using T = TestFixture::T;
831-
832- auto device = this ->unique ();
833- auto correct = this ->unique ();
834-
835- device.assign_range (correct);
836- EXPECT_EQ (device, correct);
837-
838- std::array<T, IV::capacity () + 1 > ref;
839- std::copy (correct.begin (), correct.end (), ref.begin ());
840- ref.back () = T{5 };
841- SAFE_EXPECT_THROW (device.assign_range (ref), std::bad_alloc);
842- }
843-
844726// a.assign(il)
845- // Effects: Equivalent to a.assign(il.begin(), il.end()).
846-
847- TYPED_TEST (SequenceContainerRequirements, AssignFuncInitializerList) {
848- using IV = TestFixture::IV;
849- using T = TestFixture::T;
850-
851- auto device = this ->unique ();
852-
853- if (device.capacity () == 0 ) {
854- SAFE_EXPECT_THROW (device.assign ({T{50 }}), std::bad_alloc);
855- return ;
856- }
857-
858- device.assign ({T{50 }});
859- EXPECT_EQ (device, IV{T{50 }});
860- }
861-
862727// a.assign(n, t)
863- // Result: void
864- // Preconditions: T is Cpp17CopyInsertable into X and Cpp17CopyAssignable. t is
865- // not a reference into a.
866- // Effects: Replaces elements in a with n copies of t.
867- // Invalidates all references, pointers and iterators referring to the elements
868- // of a. For vector and deque, also invalidates the past-the-end iterator. For
869- // every sequence container defined in this Clause and in [strings]:
870- //
871- // If the constructor
872- // template<class InputIterator>
873- // X(InputIterator first, InputIterator last,
874- // const allocator_type& alloc = allocator_type());
875- //
876- // is called with a type InputIterator that does not qualify as an input
877- // iterator, then the constructor shall not participate in overload resolution.
878- //
879- // If the member functions of the forms:
880- // template<class InputIterator>
881- // return-type F(const_iterator p,
882- // InputIterator first, InputIterator last); // such as
883- // insert
884- //
885- // template<class InputIterator>
886- // return-type F(InputIterator first, InputIterator last); // such as
887- // append, assign
888- //
889- // template<class InputIterator>
890- // return-type F(const_iterator i1, const_iterator i2,
891- // InputIterator first, InputIterator last); // such as
892- // replace
893- //
894- // are called with a type InputIterator that does not qualify as an input
895- // iterator, then these functions shall not participate in overload resolution.
896- // A deduction guide for a sequence container shall not participate in overload
897- // resolution if it has an InputIterator template parameter and a type that does
898- // not qualify as an input iterator is deduced for that parameter, or if it has
899- // an Allocator template parameter and a type that does not qualify as an
900- // allocator is deduced for that parameter. The following operations are
901- // provided for some types of sequence containers but not others. Operations
902- // other than prepend_range and append_range are implemented so as to take
903- // amortized constant time.
904-
905- TYPED_TEST (SequenceContainerRequirements, AssignMulti) {
906- using IV = TestFixture::IV;
907- using T = TestFixture::T;
908-
909- auto device = this ->unique ();
910- device.assign (0 , T{6312 });
911-
912- EXPECT_EQ (device, IV ());
913-
914- if (device.capacity () > 0 ) {
915- device.assign (1 , T{6312 });
916-
917- EXPECT_EQ (device, IV{T{6312 }});
918-
919- device.assign (device.capacity (), T{5972 });
920- EXPECT_EQ (device, IV (IV::capacity (), T{5972 }));
921- }
922-
923- device.clear ();
924- SAFE_EXPECT_THROW (device.assign (device.capacity () + 1 , T{12 }),
925- std::bad_alloc);
926- }
927- #endif
928728
929729// a.front()
930730// Result: reference; const_reference for constant a.
@@ -1009,37 +809,7 @@ TYPED_TEST(SequenceContainerRequirements, ElementAccess) {
1009809 EXPECT_EQ (device[i], *(device.begin () + i));
1010810}
1011811
1012- # if !BEMAN_INPLACE_VECTOR_FREESTANDING_DELETED()
812+ // These functions are marked as freestand delete.
1013813// a.at(n)
1014- // Result: reference; const_reference for constant a
1015- // Returns: *(a.begin() + n)
1016- // Throws: out_of_range if n >= a.size().
1017-
1018- TYPED_TEST (SequenceContainerRequirements, ElementAccessAt) {
1019- using IV = TestFixture::IV;
1020- using T = TestFixture::T;
1021-
1022- auto device = this ->unique ();
1023-
1024- for (auto i = 0ul ; i < device.size (); ++i) {
1025- EXPECT_EQ (device.at (i), *(device.begin () + i));
1026- }
1027-
1028- SAFE_EXPECT_THROW (device.at (IV::capacity ()), std::out_of_range);
1029- }
1030-
1031- TYPED_TEST (SequenceContainerRequirements, ElementAccessAtConst) {
1032- using IV = TestFixture::IV;
1033- using T = TestFixture::T;
1034-
1035- const auto device = this ->unique ();
1036-
1037- for (auto i = 0ul ; i < device.size (); ++i) {
1038- EXPECT_EQ (device.at (i), *(device.begin () + i));
1039- }
1040-
1041- SAFE_EXPECT_THROW (device.at (IV::capacity ()), std::out_of_range);
1042- }
1043- #endif
1044814
1045815}; // namespace
0 commit comments